diff options
Diffstat (limited to 'challenge-150/abigail/bash/ch-2.sh')
| -rw-r--r-- | challenge-150/abigail/bash/ch-2.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-150/abigail/bash/ch-2.sh b/challenge-150/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..0fe90e5309 --- /dev/null +++ b/challenge-150/abigail/bash/ch-2.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-150 +# + +# +# Run as: bash ch-2.sh +# + +set -f +PRIMES=(2 3 5 7 11 13 17 19) + +for ((n = 1; n <= 500; n ++)) +do for p in ${PRIMES[@]} + do if ((n % (p * p) == 0)) + then continue 2 + fi + done + printf "%d " $n +done + +echo |
