If you moved the 3 at the end of a certain large number to the beginning, it would be the same as multiplying it by 3. What is the number?
If x is the original number then 3x is the number after the digit 3 has been moved from back to front. We set up a long division of 3 into 3x to get the original number. It starts
So the next digit after the 3 in the dividend is 1, as that is the first digit in the quotient, before which the 3 was appended to make the dividend.
After a couple of turns of this we get:
The last digit so far is 3, but this is not the end, as it still leaves a remainder of 1. We must continue until the last digit is 3 but there is no remainder. The following program continues the algorithm:
divisor = 3
temp = 3
quot$ = ""
q = temp \ divisor
r = temp MOD divisor
quot$ = quot$ + LTRIM$(STR$(q))
IF q = 3 AND r = 0 THEN EXIT DO
temp = r * 10 + q
and finds 1034482758620689655172413793
(with commas, that's 1,034,482,758,620,689,655,172,413,793).
Posted by Charlie
on 2004-03-01 10:44:05