Numbers whose count of divisors is prime: Difference between revisions
Content added Content deleted
m (→{{header|AppleScript}}: Variable label changed. Source of squares-only idea acknowledged.) |
(Added Easylang) |
||
Line 728: | Line 728: | ||
</pre> |
</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
fastfunc isprim num . |
|||
if num mod 2 = 0 |
|||
return 0 |
|||
. |
|||
i = 3 |
|||
while i <= sqrt num |
|||
if num mod i = 0 |
|||
return 0 |
|||
. |
|||
i += 2 |
|||
. |
|||
return 1 |
|||
. |
|||
for n to 999 |
|||
cnt = 0 |
|||
for m to n |
|||
cnt += if n mod m = 0 |
|||
. |
|||
if cnt > 2 and isprim cnt = 1 |
|||
write n & " " |
|||
. |
|||
. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
4 9 16 25 49 64 81 121 169 289 361 529 625 729 841 961 |
|||
</pre> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |