17 lines
366 B
Text
17 lines
366 B
Text
[ dup 1 != if
|
|
[ tuck 1 0
|
|
[ swap temp put
|
|
temp put
|
|
over 1 > while
|
|
tuck /mod swap
|
|
temp take tuck *
|
|
temp take swap -
|
|
again ]
|
|
2drop
|
|
temp release
|
|
temp take
|
|
dup 0 < if
|
|
[ over + ] ]
|
|
nip ] is modinv ( n n --> n )
|
|
|
|
42 2017 modinv echo
|