RosettaCodeData/Task/Modular-inverse/FutureBasic/modular-inverse.basic
2025-08-11 18:05:26 -07:00

10 lines
222 B
Text

NSInteger local fn ModularInverse2( a as NSInteger, b as NSInteger )
a %= b
for NSInteger x = 1 to b - 1
if ( (a * x) % b == 1 ) then return x
next
end fn = -1
print fn ModularInverse2( 42, 2017 )
HandleEvents