Sieve of Eratosthenes: Difference between revisions
Content deleted Content added
→{{header|J}}: simplify |
|||
Line 9,626:
{{eff note|J|i.&.(p:inv) }}
Implementation:<lang J>sieve=: {{
r=. 0#t=. y# j=.1
while. y>j=.j+1 do.
if. j{t do.
t=. t > y$j{.1
r=. r, j
end.
end.
}}</lang>
Example:
<lang J> sieve 100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97</lang>
=={{header|Janet}}==
|