Find the smallest value of hexadecimal positive integer N which becomes 4*N when the last digit of N is moved to be the first. For example, turning (2345)16 into (5234)16. How about 2*N? 7*N? 8*N?
mult(1) = 4
mult(2) = 2
mult(3) = 7
mult(4) = 8
For wh = 1 To 4
For v = 16 To 1000000
b16$ = base$(v, 16)
alp$ = Right(b16$, 1) + Left(b16$, Len(b16$) - 1)
v2 = fromBase(alp$, 16)
If v2 = mult(wh) * v Then
Text1.Text = Text1.Text & v & " " & b16$ & " " & alp$ & " " & v2 & crlf
DoEvents
End If
Next v
Text1.Text = Text1.Text & crlf & crlf
Next
finds values only for 4*N and 2*N
original 4*
dec hex hex dec
260 104 410 1040 smallest
325 145 514 1300
390 186 618 1560
520 208 820 2080
585 249 924 2340
original 2*
dec hex hex dec
67650 10842 21084 135300 smallest
135300 21084 42108 270600
270600 42108 84210 541200
|
Posted by Charlie
on 2014-12-23 15:09:46 |