Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
12
Task/Population-count/Prolog/population-count.pro
Normal file
12
Task/Population-count/Prolog/population-count.pro
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
is_evil(Number) :- popcount(Number) mod 2 =:= 0.
|
||||
|
||||
:- numlist(0, 29, Powers),
|
||||
maplist([P0, P] >> (P is popcount(3 ^ P0)), Powers, PowerPopcounts),
|
||||
numlist(0, 59, Numbers),
|
||||
partition(is_evil, Numbers, EvilNumbers, OdiousNumbers),
|
||||
writeln('The pop counts of the first 30 powers of 3 are:'),
|
||||
writeln(PowerPopcounts),
|
||||
writeln('The first 30 evil numbers are:'),
|
||||
writeln(EvilNumbers),
|
||||
writeln('The first 30 odious numbers are:'),
|
||||
writeln(OdiousNumbers).
|
||||
Loading…
Add table
Add a link
Reference in a new issue