Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
27
Task/Yellowstone-sequence/Agena/yellowstone-sequence.agena
Normal file
27
Task/Yellowstone-sequence/Agena/yellowstone-sequence.agena
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
scope # Yellowstone sequence - translation of the Pluto sample
|
||||
|
||||
local procedure 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
|
||||
od;
|
||||
local minV := 4;
|
||||
for c from 4 to n do
|
||||
local more := true
|
||||
for i from minV while more do
|
||||
if not m[ i ] and numtheory.gcd( a[ c - 1 ], i ) = 1 and numtheory.gcd( a[ c - 2 ], i ) > 1
|
||||
then
|
||||
a[ c ], m[ i ] := i, true;
|
||||
if i = minV then minV +:= 1 fi;
|
||||
more := false
|
||||
fi
|
||||
od
|
||||
od;
|
||||
return a
|
||||
end;
|
||||
|
||||
local constant ySize, constant perLine := 30, 10;
|
||||
local y := yellowstone( ySize );
|
||||
printf( "The first %d Yellowstone numbers are:\n", ySize );
|
||||
for yPos to ySize do printf( " %2d", y[ yPos ] ); if yPos mod perLine = 0 then print() fi od
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue