Created
January 28, 2016 05:43
-
-
Save dardo82/85f2f3c6d811b78845f5 to your computer and use it in GitHub Desktop.
Primes < n
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Print the prime numbers less than n. | |
# for n in {1..$1}; do gfactor $n; done | awk -F'[: ]' '{if($3~$1)print $3}' | |
for n in {1..$1}; do gfactor $n; done | awk -F'[ ]' 'NF==2{printf $2" "}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment