Pernicious numbers: Difference between revisions
Content added Content deleted
(Added Easylang) |
|||
Line 1,299: | Line 1,299: | ||
→ (888888877 888888878 888888880 888888883 888888885 888888886) |
→ (888888877 888888878 888888880 888888883 888888885 888888886) |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
fastfunc isprim num . |
|||
if num < 2 |
|||
return 0 |
|||
. |
|||
i = 2 |
|||
while i <= sqrt num |
|||
if num mod i = 0 |
|||
return 0 |
|||
. |
|||
i += 1 |
|||
. |
|||
return 1 |
|||
. |
|||
func popc n . |
|||
while n > 0 |
|||
r += n mod 2 |
|||
n = n div 2 |
|||
. |
|||
return r |
|||
. |
|||
n = 1 |
|||
while cnt < 25 |
|||
if isprim popc n = 1 |
|||
write n & " " |
|||
cnt += 1 |
|||
. |
|||
n += 1 |
|||
. |
|||
print "" |
|||
n = 1 |
|||
for n = 888888877 to 888888888 |
|||
if isprim popc n = 1 |
|||
write n & " " |
|||
. |
|||
. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
3 5 6 7 9 10 11 12 13 14 17 18 19 20 21 22 24 25 26 28 31 33 34 35 36 |
|||
888888877 888888878 888888880 888888883 888888885 888888886 |
|||
</pre> |
|||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |