(I) A certain tridecimal (base 13) positive integer starts with the digit 2. Moving the 2 from the beginning of the number to its end doubles it.
What is the minimum value of this number?
(II) Determine the general form of a positive integer n such that there does not exist any base-n positive integer, starting with the digit 2, that doubles itself when the digit 2 is shifted from the beginning of the number to its end.
10 for B=4 to 500
15 Good=0
20 for N=0 to 999
30 X=(4*B^N-2)//(B-2)
35 if X=int(X) then Good=1:cancel for:goto 50
40 next
50 if Good=0 then print B;
60 next B
finds, until it overflows, the following bases that do not work:
6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82
86 90 94 98 102 106 110 114 118 122 126 130 134 138 142 146 150
154 158 162 166 170 174 178 182 186 190 194 198 202 206 210 214
218 222 226 230 234 238 242 246 250 254 258 262 266 270 274 278
282 286 290 294 298 302 306 310 314 318 322 326 330 334 338 342
346 350 354 358 362 366 370 374 378 382 386 390 394 398
Overflow in 30
The bases that do not work are those that equal 2 mod 4. Any other base will have a solution.
|
Posted by Charlie
on 2011-08-21 14:12:13 |