Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Pernicious-numbers/Picat/pernicious-numbers.picat
Normal file
22
Task/Pernicious-numbers/Picat/pernicious-numbers.picat
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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)).
|
||||
Loading…
Add table
Add a link
Reference in a new issue