Sequence of primes by trial division: Difference between revisions
Content added Content deleted
(Sequence of primes by trial division in Yabasic) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 277: | Line 277: | ||
10: 29 |
10: 29 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol>getPrimes: function [upto][ |
|||
result: new [2] |
|||
loop range.step:2 3 upto 'x [ |
|||
divisible: false |
|||
loop 2..inc x/2 'z [ |
|||
if zero? x%z -> |
|||
divisible: true |
|||
] |
|||
if not? divisible -> |
|||
'result ++ x |
|||
] |
|||
return result |
|||
] |
|||
print getPrimes 100</lang> |
|||
{{out}} |
|||
<pre>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</pre> |
|||
=={{header|AsciiDots}}== |
=={{header|AsciiDots}}== |