templates/fish/nixpkgs/soe
Kiana Sheibani a3b53b180c
style: modify the output of scripts
Instead of separating output primes by newline, the scripts now separate
by spaces.
2024-07-28 06:43:01 -04:00

20 lines
293 B
Fish
Executable file

#!/usr/bin/env fish
read -P "Primes up to: " num
echo
set nums (seq 2 $num)[..-2]
while test -n "$nums"
set prime $nums[1]
echo -n "$prime "
set -e nums_
for elem in $nums
test (math $elem % $prime) -eq 0 || set -a nums_ $elem
end
set nums $nums_
end
echo