RosettaCodeData/Task/Pernicious-numbers/Ada/pernicious-numbers-2.ada
2015-02-20 09:02:09 -05:00

14 lines
358 B
Ada

Counter: Natural;
begin
-- initialize array Prime; Prime(I) must be true if and only if I is a prime
...
Counter := 0;
-- count p. numbers below 2**32
for Y in Num(2) .. 2**32 loop
if Prime(Pop_Count(Y)) then
Counter := Counter + 1;
end if;
end loop;
Ada.Text_IO.Put_Line(Natural'Image(Counter));
end Count_Pernicious;