Skip to content

Instantly share code, notes, and snippets.

@ueokande
Created February 6, 2017 00:18
Show Gist options
  • Save ueokande/a9105321521c8b6ea44d9442b083ba23 to your computer and use it in GitHub Desktop.
Save ueokande/a9105321521c8b6ea44d9442b083ba23 to your computer and use it in GitHub Desktop.
#!/bin/sh
print_primes() {
for i in `seq 6 $1`; do
test=$(echo $i | factor | awk 'NF==2{print $2}')
if [ -n "$test" ]; then
echo $i
fi
done
}
print_primes 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment