18 lines
629 B
Plaintext
18 lines
629 B
Plaintext
REM Statements beginning 'REM' are explanatory remarks: the machine will ignore them.
|
|
|
|
REM We shall test positive integers from 1 upwards until we find one whose square ends in 269,696.
|
|
|
|
REM A number that ends in 269,696 is one that leaves a remainder of 269,696 when divided by a million.
|
|
|
|
REM So we are looking for a value of n that satisfies the condition 'n squared modulo 1,000,000 = 269,696', or 'n^2 MOD 1000000 = 269696' in the notation that the machine can accept.
|
|
|
|
LET n = 0
|
|
|
|
REPEAT
|
|
LET n = n + 1
|
|
UNTIL n^2 MOD 1000000 = 269696
|
|
|
|
PRINT "The smallest number whose square ends in 269696 is" n
|
|
|
|
PRINT "Its square is" n^2
|