Babbage problem: Difference between revisions

m
BBC BASIC: deleted a couple of superfluous comments
m (→‎{{header|REXX}}: corrected a typo, optimized a couple of versions (to just use even numbers).)
m (BBC BASIC: deleted a couple of superfluous comments)
Line 28:
 
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.
 
REM Observe that in this notation groups of digits may not be separated by commas.
 
LET n = 0
Line 37 ⟶ 35:
UNTIL n^2 MOD 1000000 = 269696
 
PRINT "The smallest number whose square ends in 269696 is" n
REM 'REPEAT... UNTIL' causes the machine to perform the addition repeatedly until the condition is satisfied.
 
PRINT "The smallest number whose square ends in 269696 is" n
PRINT "Its square is" n^2</lang>
{{out}}
519

edits