By subtracting 1 from the positive base N integer having the form XYXYXYZY, we get a perfect square. It is known that each of X, Y and Z represents a different base N digit from 0 to N-1, and X is nonzero.
What are the integer value(s) of N, with 3 ≤ N ≤ 16 for which this is possible?
I used the following code
DATA "0","1","2","3","4","5","6","7","8","9"
DATA "A","B","C","D","E","F"
DIM d$(0 TO 15)
FOR i = 0 TO 15
READ d$(i)
NEXT
FOR n = 3 TO 16
FOR x = 1 TO n - 1
FOR y = 0 TO n - 1
IF y <> x THEN
FOR z = 0 TO n - 1
IF z <> x AND z <> y THEN
num# = x * (n ^ 3 + n ^ 5 + n ^ 7) + y * (1 + n ^ 2 + n ^ 4 + n ^ 6) + z * n
v# = num# - 1
IF INT(SQR(v#)) = SQR(v#) THEN
disp$ = "Base " + STR$(n) + ": "
disp$ = disp$ + d$(x) + d$(y) + d$(x) + d$(y) + d$(x) + d$(y) + d$(z) + d$(y)
PRINT disp$
END IF
END IF
NEXT z
END IF
NEXT y
NEXT x
NEXT n
and got the following answers
Base 3: 12121202
Base 5: 32323202
Base 6: 42424202
Base 7: 52525202
Base 8: 62626202
Base 9: 72727202
Base 10: 45454565
Base 10: 82828202
Base 11: 92929202
Base 12: A2A2A202
Base 13: B2B2B202
Base 14: C2C2C202
Base 15: D2D2D202
Base 16: E2E2E202
|
Posted by Daniel
on 2009-06-24 12:52:23 |