This number can be expressed:
- by 4 distinct digits in bases 4,8,10;
- by 5 distinct digits in bases 6,7,11,15 and
- by 6 distinct digits in base 16.
There is no data about other bases.
Find the number.
To have six distinct digits in base 16 means the number has at least six digits in base 15, so the search was limited to base-15 numbers with six digits, exactly one of which was a repeat of another.
DefDbl A-Z
Dim crlf$, used(15)
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
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 a = 1 To 14
used(a) = 1
For b = 0 To 14
If used(b) < 2 And (used(b) = 0 Or dd = 0) Then
used(b) = used(b) + 1: If used(b) = 2 Then dd = 1
For c = 0 To 14
If used(c) < 2 And (used(c) = 0 Or dd = 0) Then
used(c) = used(c) + 1: If used(c) = 2 Then dd = 1
For d = 0 To 14
If used(d) < 2 And (used(d) = 0 Or dd = 0) Then
used(d) = used(d) + 1: If used(d) = 2 Then dd = 1
For e = 0 To 14
If used(e) < 2 And (used(e) = 0 Or dd = 0) Then
used(e) = used(e) + 1: If used(e) = 2 Then dd = 1
For f = 0 To 14
If used(f) < 2 And (used(f) = 0 Or dd = 0) Then
used(f) = used(f) + 1: If used(f) = 2 Then dd = 1
If dd Then
vinner = 15 * (c + 15 * (b + 15 * a))
v = f + 15 * (e + 15 * (d + vinner))
v15$ = base$(v, 15)
v6$ = base$(v, 6)
If dnumct(v6$) = 5 Then
v7$ = base$(v, 7)
If dnumct(v7$) = 5 Then
v11$ = base$(v, 11)
If dnumct(v11$) = 5 Then
v16$ = base$(v, 16)
If dnumct(v16$) = 6 Then
v10$ = base$(v, 10)
If dnumct(v10$) = 4 Then
v8$ = base$(v, 8)
If dnumct(v8$) = 4 Then
v4$ = base$(v, 4)
If dnumct(v4$) = 4 Then
good = 1
For i = 1 To Len(v11$)
If InStr("0123456789", Mid(v11$, i, 1)) = 0 Then good = 0: Exit For
Next
For i = 1 To Len(v15$)
If InStr("0123456789", Mid(v15$, i, 1)) = 0 Then good = 0: Exit For
Next
For i = 1 To Len(v16$)
If InStr("0123456789", Mid(v16$, i, 1)) = 0 Then good = 0: Exit For
Next
ct = ct + 1
If ct Mod 300 = 1 Or good = 1 Then
Text1.Text = Text1.Text & v4$
Text1.Text = Text1.Text & " " & v8$
Text1.Text = Text1.Text & " " & v10$
Text1.Text = Text1.Text & " " & v6$
Text1.Text = Text1.Text & " " & v7$
Text1.Text = Text1.Text & " " & v11$
Text1.Text = Text1.Text & " " & v15$
Text1.Text = Text1.Text & " " & v16$
If good Then Text1.Text = Text1.Text & " ****"
Text1.Text = Text1.Text & crlf
End If
End If
End If
End If
End If
DoEvents
End If
End If
End If
End If
used(f) = used(f) - 1: If used(f) = 1 Then dd = 0
End If
Next f
used(e) = used(e) - 1: If used(e) = 1 Then dd = 0
End If
Next e
used(d) = used(d) - 1: If used(d) = 1 Then dd = 0
End If
Next d
used(c) = used(c) - 1: If used(c) = 1 Then dd = 0
End If
Next c
used(b) = used(b) - 1: If used(b) = 1 Then dd = 0
End If
Next b
used(a) = 0
Next
Text1.Text = Text1.Text & ct & " 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
Function dnumct(s$)
diffnums = 0
For i = 1 To Len(s$)
If InStr(s$, Mid(s$, i, 1)) = i Then diffnums = diffnums + 1
Next
dnumct = diffnums
End Function
The program found 3659 solutions. Every 300th one is listed below as a sampling, but also listed are seven special solutions: ones in which, even in bases 11, 15 and 16, only digits valid in base 10 are used.
4 8 10 6 7 11 15 16
10010333123 4047733 1069019 34525055 12041450 670196 161b2e 104fdb
11230331332 5547576 1494910 52012514 15464224 93116a 1e7e0a 16cf7e
13233113100 7572720 2029008 111253320 23150322 1166473 2a12c3 1ef5d0
21012000320 11060070 2383928 123032412 26156141 1389098 321538 246038 ****
21012000321 11060071 2383929 123032413 26156142 1389099 321539 246039 ****
21020031121 11101531 2392921 123142201 26224306 1394923 324031 248359 ****
21300012010 11600604 2556292 130442404 30504514 1496642 357647 270184 ****
22232112301 12562661 2811313 140131201 32616151 16501aa 3a7ead 2ae5b1
32112302033 16266217 3763343 212354515 43662563 2140501 4e50e8 396c8f
100012132120 20063630 4220824 230244504 50606416 2423193 585934 406798 ****
100013020320 20071070 4223544 230305240 50620353 2425236 586649 407238 ****
102113012000 22270600 4813184 251055132 55624415 2798242 6511de 497180
111210333102 25447722 5656530 321123350 66036225 3213920 76b020 564fd2
121000130201 31003441 6555425 352301105 106502012 3778208 897535 640721 ****
121102323122 31227332 6631130 354043402 110235512 381a080 8aeba5 652eda
123222303311 33526365 7253237 415243445 115436315 4104512 984192 6eacf5
132332012000 36760600 8118656 450002212 126002360 4645737 aa57db 7be180
202111330102 42257422 9002770 520543254 136344100 5099a07 bcc74a 895f12
210313112312 44672666 9663926 543044222 145066466 5500718 cad5bb 9375b6
222123100102 52332022 11121682 1034213134 163350505 6306980 e9a4a7 a9b412
3659 done
|
Posted by Charlie
on 2015-01-06 09:30:05 |