Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
35
Task/Yellowstone-sequence/XPL0/yellowstone-sequence.xpl0
Normal file
35
Task/Yellowstone-sequence/XPL0/yellowstone-sequence.xpl0
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
func GCD(N, D); \Return the greatest common divisor of N and D
|
||||
int N, D, R; \numerator, denominator, remainder
|
||||
[if D > N then
|
||||
[R:=D; D:=N; N:=R]; \swap D and N
|
||||
while D > 0 do
|
||||
[R:= rem(N/D);
|
||||
N:= D;
|
||||
D:= R;
|
||||
];
|
||||
return N;
|
||||
];
|
||||
|
||||
int I, A(30+1), N, T;
|
||||
[for I:= 1 to 3 do A(I):= I; \givens
|
||||
N:= 4;
|
||||
repeat T:= 4;
|
||||
loop [if GCD(T, A(N-1)) = 1 and \relatively prime
|
||||
GCD(T, A(N-2)) # 1 then \not relatively prime
|
||||
[loop [for I:= 1 to N-1 do \test if in sequence
|
||||
if T = A(I) then quit;
|
||||
quit;
|
||||
];
|
||||
if I = N then \T is not in sequence so
|
||||
[A(N):= T; \ add it in
|
||||
N:= N+1;
|
||||
quit;
|
||||
];
|
||||
];
|
||||
T:= T+1; \next trial
|
||||
];
|
||||
until N > 30;
|
||||
for N:= 1 to 30 do
|
||||
[IntOut(0, A(N)); ChOut(0, ^ )];
|
||||
\\for N:= 1 to 100 do Point(N, A(N)); \plot demonstration
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue