36 lines
579 B
Plaintext
36 lines
579 B
Plaintext
function gcd(a as uinteger, b as uinteger) as uinteger
|
|
if b = 0 then return a
|
|
return gcd( b, a mod b )
|
|
end function
|
|
|
|
dim as uinteger i, j, k, Y(1 to 100)
|
|
|
|
Y(1) = 1 : Y(2) = 2: Y(3) = 3
|
|
|
|
for i = 4 to 100
|
|
k = 3
|
|
print i
|
|
do
|
|
k += 1
|
|
if gcd( k, Y(i-2) ) = 1 orelse gcd( k, Y(i-1) ) > 1 then continue do
|
|
for j = 1 to i-1
|
|
if Y(j)=k then continue do
|
|
next j
|
|
Y(i) = k
|
|
exit do
|
|
loop
|
|
next i
|
|
|
|
for i = 1 to 30
|
|
print str(Y(i))+" ";
|
|
next i
|
|
print
|
|
screen 13
|
|
for i = 1 to 100
|
|
pset (i, 200-Y(i)), 31
|
|
next i
|
|
|
|
while inkey=""
|
|
wend
|
|
end
|