templates/fish/nixpkgs/soe

18 lines
281 B
Plaintext
Raw Normal View History

2023-02-08 12:07:14 -05:00
#!/usr/bin/env fish
2024-07-28 06:35:26 -04:00
read -P "Primes up to: " num
2023-02-08 12:07:14 -05:00
echo
2023-02-08 12:56:01 -05:00
set nums (seq 2 $num)[..-2]
2023-02-08 12:07:14 -05:00
while test -n "$nums"
set prime $nums[1]
echo $prime
set -e nums_
for elem in $nums
test (math $elem % $prime) -eq 0 || set -a nums_ $elem
end
set nums $nums_
end