(A,B,C) is a 'pandigital' set of positive integers where the concatenated A|B|C is comprised of all, and only, the ten decimal digits (0 to 9) with no repeated digits. (In the following, except where the base number has a radix, all integers are in base 10.)
How many of these 'pandigital' sets exist for
- AB = C [A in base B equals C]
- AB = C [A to the power of B equals C]
Provide a separate value for each specification.
It wasn't specified that none of the numbers has a leading zero, so some instances of that occur among the 192 solutions to part 1 (in sequence a, b and c):
0148 73 5629
0167 59 3842
0189 75 6234
0193 82 7465
0194 72 5836
0197 68 5243
0235 67 9184
025 869 1743
0279 41 3658
0316 49 7258
0318 56 9472
034 625 1879
0368 41 5297
039 816 2457
0471 29 3568
048 392 1576
0497 38 6125
0521 39 7684
052 369 1847
0529 31 4876
052 963 4817
0562 39 7841
05826 9 4317
0587 42 9163
0619 25 3784
06238 9 4571
064 529 3178
069 471 2835
071 369 2584
07154 8 3692
071 693 4852
071 846 5923
073 589 4126
075 413 2896
085 246 1973
085 364 2917
085 367 2941
085 621 4973
085 792 6341
085 926 7413
085 932 7461
091 826 7435
093 642 5781
096 825 7431
096 834 7512
098 416 3752
0985 16 2437
098 713 6425
13074 8 5692
148 073 5629
148 73 05629
167 059 3842
167 59 03842
189 075 6234
189 75 06234
193 082 7465
193 82 07465
194 072 5836
194 72 05836
197 068 5243
197 68 05243
203 86 14795
205 96 18437
21547 8 9063
235 067 9184
235 67 09184
25 0869 1743
25 3407 6819
25 3698 7401
25 4067 8139
25 4079 8163
25 4307 8619
25 869 01743
270 86 15394
279 041 3658
279 41 03658
279 86 15403
28 1749 3506
28 3471 6950
28 3519 7046
28 3549 7106
28 4671 9350
28 4761 9530
304 85 21679
316 049 7258
316 49 07258
318 056 9472
318 56 09472
34 0625 1879
340 97 28615
34105 7 8629
34 2605 7819
34 625 01879
360 72 15984
3672 14 9508
368 041 5297
368 41 05297
37 2059 6184
39 0816 2457
39 1806 5427
39 2157 6480
39 816 02457
40 1738 6952
40 1963 7852
436 52 10978
45 1826 7309
46 1273 5098
471 029 3568
47 1269 5083
471 29 03568
48 0392 1576
48 392 01576
497 038 6125
497 38 06125
502 63 19847
510 69 23874
52 0369 1847
52 0963 4817
521 039 7684
521 39 07684
52 369 01847
529 031 4876
529 31 04876
52 963 04817
562 039 7841
562 39 07841
568 49 12307
5730 12 9684
58 1279 6403
5826 09 4317
5826 9 04317
587 042 9163
587 42 09163
619 025 3784
619 25 03784
6238 09 4571
6238 9 04571
64 0529 3178
64 529 03178
65 1304 7829
67 1342 8059
675 83 41920
682 54 17930
69 0471 2835
69 471 02835
701 59 24368
706 52 18934
71 0369 2584
71 0693 4852
71 0846 5923
71 369 02584
7154 08 3692
7154 8 03692
71 693 04852
71 846 05923
73 0589 4126
73 589 04126
75 0413 2896
75 1403 9826
75 413 02896
802 67 35914
835 96 74021
85 0246 1973
85 0364 2917
85 0367 2941
85 0621 4973
85 0792 6341
85 0926 7413
85 0932 7461
85 1204 9637
85 246 01973
85 364 02917
85 367 02941
85 621 04973
85 792 06341
85 926 07413
85 932 07461
865 39 12407
91 0826 7435
91 826 07435
93 0642 5781
93 642 05781
96 0825 7431
96 0834 7512
96 825 07431
96 834 07512
98 0416 3752
98 0713 6425
98 416 03752
985 016 2437
985 16 02437
98 713 06425
The 48 solutions, taken from above, that do not have any leading zeros are:
13074 8 5692
203 86 14795
205 96 18437
21547 8 9063
25 3407 6819
25 3698 7401
25 4067 8139
25 4079 8163
25 4307 8619
270 86 15394
279 86 15403
28 1749 3506
28 3471 6950
28 3519 7046
28 3549 7106
28 4671 9350
28 4761 9530
304 85 21679
340 97 28615
34105 7 8629
34 2605 7819
360 72 15984
3672 14 9508
37 2059 6184
39 1806 5427
39 2157 6480
40 1738 6952
40 1963 7852
436 52 10978
45 1826 7309
46 1273 5098
47 1269 5083
502 63 19847
510 69 23874
568 49 12307
5730 12 9684
58 1279 6403
65 1304 7829
67 1342 8059
675 83 41920
682 54 17930
701 59 24368
706 52 18934
75 1403 9826
802 67 35914
835 96 74021
85 1204 9637
865 39 12407
Me.Visible = True
ChDir "C:\Program Files\DevStudio\VB\projects\flooble"
Open "pandigital value abc 1.txt" For Output As #2
dig$ = "9876543210": h = dig$
Do
For lenva = 2 To 8
a = Left(dig$, lenva)
DoEvents
For lenvb = 1 To 10 - lenva - 1
DoEvents
b = Mid(dig$, lenva + 1, lenvb)
ValB = Val(b)
If ValB > 0 Then
lenvc = 10 - lenva - lenvb
c = Mid(dig$, lenva + lenvb + 1)
vc = Val(c)
tst = baseConv(a, ValB)
If tst > vc Then Exit For
If tst = vc Then
highD = ValB - 1
good = True
For i = 1 To Len(a)
If Val(Mid(a, i, 1)) > highD Then good = False
Next i
If good Then
CurrentX = 1: CurrentY = 1
Print a; " "; b; " "; c; " "
Print #2, a; " "; b; " "; c
End If
End If
End If
Next lenvb
Next lenva
permute dig$
Loop Until h = dig$
Print "end"
Close 2
End Sub
Function baseConv(a, b)
v = 0
For i = 1 To Len(a)
v = v * b + Val(Mid(a, i, 1))
Next i
baseConv = v
End Function
|
Posted by Charlie
on 2009-12-29 14:48:26 |