Pernicious numbers: Difference between revisions

m (→‎{{header|Phix}}: syntax coloured)
Line 2,189:
{888888877,888888878,888888880,888888883,888888885,888888886}
</pre>
 
=={{header|Picat}}==
<lang Picat>go =>
println(take_n(pernicious_number,25,1)),
println([J : J in 888888877..888888888, pernicious_number(J)]),
nl.
 
% Get the first N numbers that satisfies function F, starting with S
take_n(F,N,S) = L =>
I = S,
C = 0,
L = [],
while(C < N)
if call(F,I) then
L := L ++ [I],
C := C + 1
end,
I := I + 1
end.
 
pop_count(N) = sum([1: I in N.to_binary_string(), I = '1']).
 
pernicious_number(N) => prime(pop_count(N)).</lang>
 
{{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|PicoLisp}}==
495

edits