Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,54 +0,0 @@
-- Rosetta Code Task written in Ada
-- Giuga numbers
-- https://rosettacode.org/wiki/Giuga_numbers
-- Translated from the Nim solution
-- July 2024, R. B. E.
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 Giuga_Numbers is
function Is_Giuga (M : Natural) return Boolean is
N : Natural := M;
F : Natural := 2;
L : Integer := Integer (sqrt (Float (N)));
begin
loop
if ((N mod F) = 0) then
if ((((M / F) - 1) mod F) /= 0) then
return False;
end if;
N := N / F;
if (F > N) then
return True;
end if;
else
F := F + 1;
if (F > L) then
return False;
end if;
end if;
end loop;
end Is_Giuga;
C : Natural := 0;
N : Natural := 3;
Limit : constant Integer := 4;
begin
Put ("The first ");
Put (Limit, 1);
Put (" Giuga numbers are: ");
loop
if (Is_Giuga (N)) then
C := C + 1;
Put (N, 1);
Put (" ");
end if;
N := N + 1;
exit when C = Limit;
end loop;
New_Line;
end Giuga_Numbers;

View file

@ -1,6 +1,9 @@
giuga?: function [n]->
and? -> not? prime? n
-> every? factors.prime n 'f
-> zero? (dec n/f) % f
giuga?: function [n][
if prime? n -> return false
unless positive? size facts: <= factors.prime n -> return false
every? facts 'f ->
zero? (dec n/f) % f
]
print.lines select.first:4 1..∞ => giuga?