Jump to content

Lucas-Lehmer test: Difference between revisions

m
→‎{{header|Ada}}: Simplified code
m (→‎{{header|Ada}}: Changed from long_long_integer to 64 bit unsigned integer)
m (→‎{{header|Ada}}: Simplified code)
Line 9:
with Ada.Text_Io; use Ada.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
Line 26 ⟶ 25:
end if;
end Mersenne;
Upper_Bound : constant Integer := Integer(Float'Rounding(Log(10.0) / Log(2.0) * 10_000_000.0))64;
M_Count : Natural := 0;
begin
Put_Line(" Mersenne primes:");
Line 34 ⟶ 32:
Put(" M");
Put(Item => P, Width => 1);
M_Count := M_Count + 1;
exit when M_Count = 45;
end if;
end loop;
end Lucas_Lehmer_Test;
 
Output:
Mersenne primes:
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.