Pernicious numbers: Difference between revisions

m
Added Easylang
m (Added Easylang)
 
(3 intermediate revisions by 2 users not shown)
Line 1,285:
1_421_120_880 Pernicious numbers in the unsigned 32 bit range in less than 48 seconds with this line:
<syntaxhighlight lang="d">uint.max.iota.filter!pernicious.walkLength.writeln;</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|EchoLisp}}==
Line 3,770 ⟶ 3,816:
=={{header|Wren}}==
{{trans|Go}}
<syntaxhighlight lang="ecmascriptwren">var pernicious = Fn.new { |w|
var ff = 2.pow(32) - 1
var mask1 = (ff / 3).floor
2,046

edits