27 lines
597 B
Text
27 lines
597 B
Text
[ [ dup while
|
|
tuck mod again ]
|
|
drop abs ] is gcd ( n n --> n )
|
|
|
|
[ 2dup peek
|
|
dip [ 1+ 2dup peek ]
|
|
over + swap join
|
|
swap dip join ] is two-terms ( [ n --> [ n )
|
|
|
|
' [ 1 1 ] 0
|
|
8 times two-terms
|
|
over 15 split drop
|
|
witheach [ echo sp ] cr
|
|
[ two-terms
|
|
over -2 peek 100 = until ]
|
|
drop
|
|
10 times
|
|
[ i^ 1+ over find 1+ echo sp ] cr
|
|
dup size 1 - echo cr
|
|
false swap
|
|
behead swap witheach
|
|
[ tuck gcd 1 != if
|
|
[ dip not conclude ] ]
|
|
drop iff
|
|
[ say "Reducible pair found." ]
|
|
else
|
|
[ say "No reducible pairs found." ]
|