Determine all possible triplet(s) of positive integers (X, Y, Z) such that the decimal representation of XY*(X+1)Z has no leading zeroes and contains each of the digits from 0 to 9 exactly once.
The more interesting ones are (23, 3, 4) giving 4036718592, (264, 3, 1) giving 4875932160, (1253, 1, 2) giving 1970362548, (1818, 1, 2) giving 6015327498 and (2016, 2, 1) giving 8197604352. The rest all have y and z = 1 for just x*(x+1) equalling the pandigital.
A list of all 57 solutions follows the program listing.
DEFDBL A-Z
CLS
FOR x = 1 TO 99999
y = 1: p1 = x
DO
z = 1: p2 = x + 1
DO
v = p1 * p2
s$ = LTRIM$(STR$(v))
IF LEN(s$) = 10 THEN
good = 1
FOR i = 1 TO 9
IF INSTR(i + 1, s$, MID$(s$, i, 1)) THEN good = 0: EXIT FOR
NEXT
IF good THEN
PRINT USING "##### ### ### ##########"; x; y; z; v
ct = ct + 1: IF ct MOD 40 = 0 THEN DO: LOOP UNTIL INKEY$ > "": PRINT
END IF
END IF
z = z + 1: p2 = p2 * (x + 1)
LOOP UNTIL v > 9999999999#
y = y + 1: p1 = p1 * x
LOOP UNTIL p1 > 9999999999# OR x = 1
NEXT x
x y z x^y * (x+1)^z
23 3 4 4036718592
264 3 1 4875932160
1253 1 2 1970362548
1818 1 2 6015327498
2016 2 1 8197604352
38627 1 1 1492083756
40508 1 1 1640938572
43065 1 1 1854637290
44027 1 1 1938420756
44576 1 1 1987064352
46565 1 1 2168345790
48735 1 1 2375148960
51714 1 1 2674389510
54269 1 1 2945178630
54459 1 1 2965837140
55151 1 1 3041687952
55152 1 1 3041798256
55331 1 1 3061574892
55403 1 1 3069547812
58454 1 1 3416928570
59579 1 1 3549716820
61497 1 1 3781942506
63072 1 1 3978140256
65465 1 1 4285731690
67580 1 1 4567123980
67662 1 1 4578213906
70154 1 1 4921653870
73737 1 1 5437218906
74906 1 1 5610983742
75662 1 1 5724813906
76203 1 1 5806973412
76337 1 1 5827413906
76760 1 1 5892174360
78011 1 1 6085794132
80631 1 1 6501438792
82809 1 1 6857413290
83015 1 1 6891573240
84555 1 1 7149632580
86076 1 1 7409163852
86553 1 1 7491508362
86688 1 1 7514896032
86769 1 1 7528946130
87669 1 1 7685941230
89064 1 1 7932485160
90198 1 1 8135769402
90423 1 1 8176409352
90909 1 1 8264537190
91943 1 1 8453607192
92169 1 1 8495216730
92268 1 1 8513476092
93356 1 1 8715436092
94464 1 1 8923541760
94617 1 1 8952471306
96362 1 1 9285731406
96570 1 1 9325861470
98702 1 1 9742183506
99270 1 1 9854632170
|
Posted by Charlie
on 2009-06-06 16:53:10 |