Skip to content

Instantly share code, notes, and snippets.

@dardo82
Created January 28, 2016 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dardo82/85f2f3c6d811b78845f5 to your computer and use it in GitHub Desktop.
Save dardo82/85f2f3c6d811b78845f5 to your computer and use it in GitHub Desktop.
Primes < n
#!/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