Restructure everything
This commit is contained in:
parent
81ca8af870
commit
a8a26921b4
19 changed files with 227 additions and 67 deletions
22
bash/nixpkgs/soe
Executable file
22
bash/nixpkgs/soe
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo -n "Primes up to: "
|
||||
read num
|
||||
echo
|
||||
|
||||
nums=()
|
||||
for i in `seq 2 $num`; do
|
||||
nums+=($i)
|
||||
done
|
||||
|
||||
unset nums[-1]
|
||||
|
||||
while [ -n "$nums" ]; do
|
||||
prime=${nums[0]}
|
||||
echo $prime
|
||||
nums_=()
|
||||
for elem in "${nums[@]}"; do
|
||||
[ $(( $elem % $prime )) -eq 0 ] || nums_+=($elem)
|
||||
done
|
||||
nums=(${nums_[@]})
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue