Ludic numbers: Difference between revisions
m
→{{header|Ada}}
(Ada version) |
m (→{{header|Ada}}) |
||
Line 367:
end Fill;
procedure
use Ada.Text_IO;
begin
Put_Line ("Lucid numbers " & First'Image & " to " &
for I in
Put (Natural'(List (I))'Image);
end loop;
New_Line;
end
procedure
Count : Natural := 0;
begin
for Lucid of List loop
if Lucid <=
Count := Count + 1;
end if;
end loop;
Ada.Text_IO.Put_Line ("There are " & Count'Image & " lucid numbers
end
procedure Find_Triplets (Limit : in Natural) is
function
begin
for X in 1 .. Limit loop
Line 408 ⟶ 398:
end loop;
return False;
end
use Ada.Text_IO;
begin
Put_Line ("All triplets of lucid numbers <" & Limit'Image);
while List (
if
Put ("(");
Put (
Put (Natural'(
Put (Natural'(
Put_Line (")");
end if;
end loop;
end Find_Triplets;
Line 431 ⟶ 421:
begin
Fill;
Put_Lucid (First => 1,
Last => 25);
Count_Lucid (Below => 1000);
Put_Lucid (First => 2000,
Find_Triplets (250);▼
Last => 2005);
▲ Find_Triplets (Limit => 250);
end Ludic_Numbers;</lang>
{{out}}
<pre>
1 2 3 5 7 11 13 17 23 25 29 37 41 43 47 53 61 67 71 77 83 89 91 97 107
There are 142 lucid numbers
Lucid
21475 21481 21487 21493 21503 21511
All triplets of lucid numbers < 250
|