Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,68 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
with Ada.Containers.Ordered_Sets;
|
||||
|
||||
procedure Yellowstone_Sequence is
|
||||
|
||||
generic -- Allow more than one generator, but must be instantiated
|
||||
package Yellowstones is
|
||||
function Next return Integer;
|
||||
function GCD (Left, Right : Integer) return Integer;
|
||||
end Yellowstones;
|
||||
|
||||
package body Yellowstones
|
||||
is
|
||||
package Sequences is
|
||||
new Ada.Containers.Ordered_Sets (Integer);
|
||||
|
||||
-- Internal package state
|
||||
N_0 : Integer := 0;
|
||||
N_1 : Integer := 0;
|
||||
N_2 : Integer := 0;
|
||||
Seq : Sequences.Set;
|
||||
Min : Integer := 1;
|
||||
|
||||
function GCD (Left, Right : Integer) return Integer
|
||||
is (if Right = 0
|
||||
then Left
|
||||
else GCD (Right, Left mod Right));
|
||||
|
||||
function Next return Integer is
|
||||
begin
|
||||
N_2 := N_1;
|
||||
N_1 := N_0;
|
||||
if N_0 < 3 then
|
||||
N_0 := N_0 + 1;
|
||||
else
|
||||
N_0 := Min;
|
||||
while
|
||||
not (not Seq.Contains (N_0)
|
||||
and then GCD (N_1, N_0) = 1
|
||||
and then GCD (N_2, N_0) > 1)
|
||||
loop
|
||||
N_0 := N_0 + 1;
|
||||
end loop;
|
||||
end if;
|
||||
Seq.Insert (N_0);
|
||||
while Seq.Contains (Min) loop
|
||||
Seq.Delete (Min);
|
||||
Min := Min + 1;
|
||||
end loop;
|
||||
return N_0;
|
||||
end Next;
|
||||
|
||||
end Yellowstones;
|
||||
|
||||
procedure First_30 is
|
||||
package Yellowstone is new Yellowstones; -- New generator instance
|
||||
use Ada.Text_IO;
|
||||
begin
|
||||
Put_Line ("First 30 Yellowstone numbers:");
|
||||
for A in 1 .. 30 loop
|
||||
Put (Yellowstone.Next'Image); Put (" ");
|
||||
end loop;
|
||||
New_Line;
|
||||
end First_30;
|
||||
|
||||
begin
|
||||
First_30;
|
||||
end Yellowstone_Sequence;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
scope # Yellowstone sequence - translation of the Pluto sample
|
||||
|
||||
local procedure yellowstone( n :: number ) :: table
|
||||
local proc yellowstone( n :: number ) :: table
|
||||
local a, m := [ 1, 2, 3 ], [ true, true, true ];
|
||||
for x from 4 to n do
|
||||
a[ x ], m[ x ] := 0, false
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
yellowstone: function [n][
|
||||
result: new [1 2 3]
|
||||
present: new [1 2 3]
|
||||
start: new 4
|
||||
result: [1 2 3]
|
||||
present: [1 2 3]
|
||||
start: 4
|
||||
while [n > size result][
|
||||
candidate: new start
|
||||
while ø [
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-- 28 Jul 2025
|
||||
include Settings
|
||||
-- 24 Aug 2025
|
||||
include Setting
|
||||
numeric digits 100
|
||||
arg xx
|
||||
if xx = '' then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue