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

 Pandigital and Pretty Powerful IV (Posted on 2009-06-06)
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.

 See The Solution Submitted by K Sengupta Rating: 5.0000 (1 votes)

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

I used the following code

CLS 0
OPEN ".\output.txt" FOR OUTPUT AS #1
DEF fnIsPan (n#)
s\$ = STR\$(n#)
IF LEN(s\$) = 11 THEN
fail = 0
i = 1
WHILE i < LEN(s\$) AND fail = 0
j = i + 1
WHILE j <= LEN(s\$) AND fail = 0
IF MID\$(s\$, i, 1) = MID\$(s\$, j, 1) THEN
fail = 1
END IF
j = j + 1
WEND
i = i + 1
WEND
fnIsPan = 1 - fail
ELSE
fnIsPan = 0
END IF
END DEF
x# = 2
mx# = 9876543210#
WHILE x# * (x# + 1) <= mx#
y# = 1
WHILE (x# ^ y#) * (x# + 1) <= mx#
z# = 1
WHILE (x# ^ y#) * (x# + 1) ^ z# <= mx#
num# = (x# ^ y#) * (x# + 1) ^ z#
IF fnIsPan(num#) = 1 THEN
PRINT #1, "(" + STR\$(x#) + "," + STR\$(y#) + "," + STR\$(z#) + ") : " + STR\$(num#)
END IF
z# = z# + 1
WEND
y# = y# + 1
WEND
x# = x# + 1
WEND
CLOSE #1

and got the following solutions

( 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 Daniel on 2009-06-06 13:32:41

 Search: Search body:
Forums (0)