Determine the largest five digit base-14 positive integer such that when multiplied by a single base-14 digit, the result is a six digit base-14 positive integer with all digits identical.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
For repdigit = 1 To 13
repdnum = Int(repdigit * (14 ^ 6 - 1) / 13 + 0.5)
For divsr = 1 To 13
q = repdnum / divsr
If Int(q) = q Then
b14$ = base$(q, 14)
If Len(b14$) = 5 Then
Text1.Text = Text1.Text & b14$ & "(" & (q) & ")" & " " & base$(repdnum, 14)
Text1.Text = Text1.Text & "(" & (repdnum) & ")"
Text1.Text = Text1.Text & " " & base$(divsr, 14) & crlf
End If
End If
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function base$(n, b)
v$ = ""
n2 = n
Do
d = n2 Mod b
n2 = n2 \ b
v$ = Mid("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", d + 1, 1) + v$
Loop Until n2 = 0
base$ = v$
End Function
finds, (lines sorted by a separate step), this list of all such 5-digit base-14 integers:
base-14 decimal product
integer equivalent base-14 decimal multiplier
1964B (64355) 111111(579195) 9
30303 (115839) 111111(579195) 5
30303 (115839) 222222(1158390) A
34C98 (128710) 222222(1158390) 9
50505 (193065) 111111(579195) 3
50505 (193065) 222222(1158390) 6
50505 (193065) 333333(1737585) 9
50505 (193065) 444444(2316780) C
60606 (231678) 222222(1158390) 5
60606 (231678) 444444(2316780) A
69B52 (257420) 444444(2316780) 9
8539D (321775) 555555(2895975) 9
90909 (347517) 333333(1737585) 5
90909 (347517) 666666(3475170) A
A0A0A (386130) 222222(1158390) 3
A0A0A (386130) 444444(2316780) 6
A0A0A (386130) 666666(3475170) 9
A0A0A (386130) 888888(4633560) C
BA257 (450485) 777777(4054365) 9
C0C0C (463356) 444444(2316780) 5
C0C0C (463356) 888888(4633560) A
D58A4 (514840) 888888(4633560) 9
So the largest is therefore D58A4, which when multiplied by 9 produces 888888.
|
Posted by Charlie
on 2014-09-08 11:07:11 |