20 lines
1.1 KiB
Plaintext
20 lines
1.1 KiB
Plaintext
Remark:Lines identified as "remarks" are intended for the human reader, and will be ignored by the machine.
|
|
Remark:A "compute" instruction gives a value to a variable.
|
|
Remark:We begin by making the variable n equal to 2.
|
|
Compute:n = 2
|
|
Remark:Lines beginning with asterisks are labels. We can instruct the machine to "jump" to them, rather than carrying on to the next instruction as it normally would.
|
|
*CheckNextNumber
|
|
Remark:In "compute" instructions, "x * y" should be read as "x times y" and "x % y" as "x modulo y".
|
|
Compute:square = n * n
|
|
Compute:lastSix = square % 1000000
|
|
Remark:A "jump" instruction that includes an equation or an inequality in parentheses jumps to the designated label if and only if the equation or inequality is true.
|
|
Jump( lastSix = 269696 ):*FoundIt
|
|
Remark:If the last six digits are not equal to 269696, add 2 to n and jump back to "CheckNextNumber".
|
|
Compute:n = n + 2
|
|
Jump:*CheckNextNumber
|
|
*FoundIt
|
|
Remark:Type, i.e. print, the result. The symbol "#" means that what follows is one of our variables and the machine should type its value.
|
|
Type:The smallest number whose square ends in 269696 is #n. Its square is #square.
|
|
Remark:The end.
|
|
End:
|