22 lines
321 B
Text
22 lines
321 B
Text
subr first
|
|
n = 1 ; d = 1
|
|
.
|
|
proc next . .
|
|
n = 2 * (n div d) * d + d - n
|
|
swap n d
|
|
.
|
|
print "The first 20 terms of the Calkwin-Wilf sequence are:"
|
|
first
|
|
for i to 20
|
|
write n & "/" & d & " "
|
|
next
|
|
.
|
|
print ""
|
|
#
|
|
first
|
|
i = 1
|
|
while n <> 83116 or d <> 51639
|
|
next
|
|
i += 1
|
|
.
|
|
print "83116/51639 is at position " & i
|