templates/fish/nixpkgs/soe

19 lines
292 B
Plaintext
Raw Normal View History

2023-02-08 12:07:14 -05:00
#!/usr/bin/env fish
2024-07-28 06:01:20 -04:00
echo -n "Primes up to: "
2023-02-08 12:07:14 -05:00
read -P "" num
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