Lucas-Lehmer test: Difference between revisions
Content added Content deleted
m (→{{header|Ada}}: Changed from long_long_integer to 64 bit unsigned integer) |
m (→{{header|Ada}}: Simplified code) |
||
Line 9: | Line 9: | ||
with Ada.Text_Io; use Ada.Text_Io; |
with Ada.Text_Io; use Ada.Text_Io; |
||
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io; |
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io; |
||
with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; |
|||
procedure Lucas_Lehmer_Test is |
procedure Lucas_Lehmer_Test is |
||
Line 26: | Line 25: | ||
end if; |
end if; |
||
end Mersenne; |
end Mersenne; |
||
Upper_Bound : constant Integer := |
Upper_Bound : constant Integer := 64; |
||
M_Count : Natural := 0; |
|||
begin |
begin |
||
Put_Line(" Mersenne primes:"); |
Put_Line(" Mersenne primes:"); |
||
Line 34: | Line 32: | ||
Put(" M"); |
Put(" M"); |
||
Put(Item => P, Width => 1); |
Put(Item => P, Width => 1); |
||
M_Count := M_Count + 1; |
|||
exit when M_Count = 45; |
|||
end if; |
end if; |
||
end loop; |
end loop; |
||
end Lucas_Lehmer_Test; |
end Lucas_Lehmer_Test; |
||
Output: |
Output: |
||
Mersenne primes: |
Mersenne primes: |