All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Pandigital ABCs (Posted on 2009-12-28)
(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.

 See The Solution Submitted by Dej Mar No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution to part 1 Comment 5 of 5 |

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 56290167 59 38420189 75 62340193 82 74650194 72 58360197 68 52430235 67 9184025 869 17430279 41 36580316 49 72580318 56 9472034 625 18790368 41 5297039 816 24570471 29 3568048 392 15760497 38 61250521 39 7684052 369 18470529 31 4876052 963 48170562 39 784105826 9 43170587 42 91630619 25 378406238 9 4571064 529 3178069 471 2835071 369 258407154 8 3692071 693 4852071 846 5923073 589 4126075 413 2896085 246 1973085 364 2917085 367 2941085 621 4973085 792 6341085 926 7413085 932 7461091 826 7435093 642 5781096 825 7431096 834 7512098 416 37520985 16 2437098 713 642513074 8 5692148 073 5629148 73 05629167 059 3842167 59 03842189 075 6234189 75 06234193 082 7465193 82 07465194 072 5836194 72 05836197 068 5243197 68 05243203 86 14795205 96 1843721547 8 9063235 067 9184235 67 0918425 0869 174325 3407 681925 3698 740125 4067 813925 4079 816325 4307 861925 869 01743270 86 15394279 041 3658279 41 03658279 86 1540328 1749 350628 3471 695028 3519 704628 3549 710628 4671 935028 4761 9530304 85 21679316 049 7258316 49 07258318 056 9472318 56 0947234 0625 1879340 97 2861534105 7 862934 2605 781934 625 01879360 72 159843672 14 9508368 041 5297368 41 0529737 2059 618439 0816 245739 1806 542739 2157 648039 816 0245740 1738 695240 1963 7852436 52 1097845 1826 730946 1273 5098471 029 356847 1269 5083471 29 0356848 0392 157648 392 01576497 038 6125497 38 06125502 63 19847510 69 2387452 0369 184752 0963 4817521 039 7684521 39 0768452 369 01847529 031 4876529 31 0487652 963 04817562 039 7841562 39 07841568 49 123075730 12 968458 1279 64035826 09 43175826 9 04317587 042 9163587 42 09163619 025 3784619 25 037846238 09 45716238 9 0457164 0529 317864 529 0317865 1304 782967 1342 8059675 83 41920682 54 1793069 0471 283569 471 02835701 59 24368706 52 1893471 0369 258471 0693 485271 0846 592371 369 025847154 08 36927154 8 0369271 693 0485271 846 0592373 0589 412673 589 0412675 0413 289675 1403 982675 413 02896802 67 35914835 96 7402185 0246 197385 0364 291785 0367 294185 0621 497385 0792 634185 0926 741385 0932 746185 1204 963785 246 0197385 364 0291785 367 0294185 621 0497385 792 0634185 926 0741385 932 07461865 39 1240791 0826 743591 826 0743593 0642 578193 642 0578196 0825 743196 0834 751296 825 0743196 834 0751298 0416 375298 0713 642598 416 03752985 016 2437985 16 0243798 713 06425`

The 48 solutions, taken from above, that do not have any leading zeros are:

`13074 8 5692203 86 14795205 96 1843721547 8 906325 3407 681925 3698 740125 4067 813925 4079 816325 4307 8619270 86 15394279 86 1540328 1749 350628 3471 695028 3519 704628 3549 710628 4671 935028 4761 9530304 85 21679340 97 2861534105 7 862934 2605 7819360 72 159843672 14 950837 2059 618439 1806 542739 2157 648040 1738 695240 1963 7852436 52 1097845 1826 730946 1273 509847 1269 5083502 63 19847510 69 23874568 49 123075730 12 968458 1279 640365 1304 782967 1342 8059675 83 41920682 54 17930701 59 24368706 52 1893475 1403 9826802 67 35914835 96 7402185 1204 9637865 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

 Search: Search body:
Forums (0)