18 lines
261 B
Plaintext
18 lines
261 B
Plaintext
|
#!/usr/bin/env fish
|
||
|
|
||
|
read -P "" num
|
||
|
echo
|
||
|
|
||
|
set nums (seq 2 $num)
|
||
|
|
||
|
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
|