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

 A number pyramid (Posted on 2012-05-18)
Divide a set of 10 distinct digits into 4 subsets, each containing a different number of digits, adhering to the following conditions:

Two sets contain digits that can form a reversible prime, in the third set one can create a reversible square number and the remaining set has exactly one member twice as big as another.

Obeying the above restrictions do we get two distinct solutions - as I hope - or more?

 See The Solution Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer result: 11 solutions and two almost-solutions | Comment 1 of 3

Ten digits arranged in four sets, each with a different cardinality, must be in sets of 1, 2, 3 and 4 digits. This programs seeks all such that satisfy the conditions set:

DECLARE SUB permute (a\$)
DATA 2,3,5,7,13,17,37,79,107,149,157,167
DATA 179,347,359,389,709,739,769,1069,1097,1237
DATA 1249,1259,1279,1283,1409,1429,1439,1453,1487
DATA 1523,1583,1597,1657,1723,1753,1789,1847,1867
DATA 1879,3019,3049,3067,3089,3109,3169,3257,3407
DATA 3467,3469,3527,3697,3719,3917,7219,7349,7459
DATA 7529,7589,7649

DIM rprime(61)

FOR i = 1 TO 61: READ rprime(i): NEXT
primct = 61

DIM rsquare(6)
WHILE sq < 10000
sq = n * n
sqs\$ = LTRIM\$(STR\$(sq))
revs\$ = "": good = 1: REDIM dig(9)
FOR i = 1 TO LEN(sqs\$)
revs\$ = MID\$(sqs\$, i, 1) + revs\$
d = VAL(MID\$(sqs\$, i, 1))
IF dig(d) THEN good = 0
dig(d) = 1
NEXT
r = VAL(revs\$)
sr = INT(SQR(r) + .5)
IF sr * sr = r AND r >= sq AND good = 1 THEN
sqct = sqct + 1
rsquare(sqct) = sq
PRINT sq;
END IF
n = n + 1
WEND
PRINT sqct

digs\$ = "0123456789": h\$ = digs\$

OPEN "rprimesol.txt" FOR OUTPUT AS #2

DO
IF MID\$(digs\$, 2, 1) > "0" AND MID\$(digs\$, 4, 1) > "0" AND MID\$(digs\$, 7, 1) > "0" THEN
a = VAL(MID\$(digs\$, 1, 1))
b = VAL(MID\$(digs\$, 2, 2))
c = VAL(MID\$(digs\$, 4, 3))
d = VAL(MID\$(digs\$, 7, 4))
FOR i = 1 TO primct
IF a = rprime(i) OR b = rprime(i) OR c = rprime(i) OR d = rprime(i) THEN
IF a = rprime(i) THEN hp(hadprime) = 1
IF b = rprime(i) THEN hp(hadprime) = 2
IF c = rprime(i) THEN hp(hadprime) = 3
IF d = rprime(i) THEN hp(hadprime) = 4
END IF
NEXT
FOR i = 1 TO sqct
IF a = rsquare(i) OR b = rsquare(i) OR c = rsquare(i) OR d = rsquare(i) THEN
IF a = rsquare(i) THEN hs(hadsq) = 1
IF b = rsquare(i) THEN hs(hadsq) = 2
IF c = rsquare(i) THEN hs(hadsq) = 3
IF d = rsquare(i) THEN hs(hadsq) = 4
END IF
NEXT
FOR whsq = 1 TO hadsq
whchk = 10 - hp(1) - hp(2) - hs(whsq)
good = 1
SELECT CASE whchk
CASE 1
good = 0
CASE 2
IF VAL(MID\$(digs\$, 3, 1)) <> 2 * VAL(MID\$(digs\$, 2, 1)) THEN good = 0
CASE 3
IF VAL(MID\$(digs\$, 5, 1)) <> 2 * VAL(MID\$(digs\$, 4, 1)) AND VAL(MID\$(digs\$, 6, 1)) <> 2 * VAL(MID\$(digs\$, 4, 1)) AND VAL(MID\$(digs\$, 6, 1)) <> 2 * VAL(MID\$(digs\$, 5, 1)) THEN good = 0
IF VAL(MID\$(digs\$, 5, 1)) < VAL(MID\$(digs\$, 4, 1)) OR VAL(MID\$(digs\$, 6, 1)) < VAL(MID\$(digs\$, 5, 1)) THEN good = 0
CASE 4
good = 0
IF VAL(MID\$(digs\$, 8, 1)) = 2 * VAL(MID\$(digs\$, 7, 1)) THEN good = 1
IF VAL(MID\$(digs\$, 9, 1)) = 2 * VAL(MID\$(digs\$, 7, 1)) THEN good = 1
IF VAL(MID\$(digs\$, 9, 1)) = 2 * VAL(MID\$(digs\$, 8, 1)) THEN good = 1
IF VAL(MID\$(digs\$, 10, 1)) = 2 * VAL(MID\$(digs\$, 7, 1)) THEN good = 1
IF VAL(MID\$(digs\$, 10, 1)) = 2 * VAL(MID\$(digs\$, 8, 1)) THEN good = 1
IF VAL(MID\$(digs\$, 10, 1)) = 2 * VAL(MID\$(digs\$, 9, 1)) THEN good = 1
IF VAL(MID\$(digs\$, 10, 1)) < VAL(MID\$(digs\$, 9, 1)) OR VAL(MID\$(digs\$, 9, 1)) < VAL(MID\$(digs\$, 8, 1)) OR VAL(MID\$(digs\$, 8, 1)) < VAL(MID\$(digs\$, 7, 1)) THEN good = 0
END SELECT
IF good THEN
PRINT a; b; c; d, hp(1); hp(2), hs(whsq)
PRINT #2, a; b; c; d, hp(1); hp(2), hs(whsq)
END IF
NEXT whsq
END IF
END IF
permute digs\$
LOOP UNTIL digs\$ = h\$
CLOSE 2

It finds the following list of solutions. The size number that's not listed as prime or square is the one that contains a digit that's double  The ones I've marked with an asterisk, though, fail to have exactly one digit that's double another in the set that's neither prime nor square, as they contain 2, 4 and 8.

`       Sets                sizes of     size ofarranged as numbers         primes      square`
` 0  13  246  7589            2  4          1  0  13  468  7529            2  4          1  0  13  769  2458            2  3          1    * 0  17  359  2468            2  3          1    * 0  17  389  2456            2  3          1  0  24  359  1867            3  4          1  0  24  389  1657            3  4          1  0  24  769  1583            3  4          1  0  37  468  1259            2  4          1  0  48  769  1523            3  4          1  0  79  246  1583            2  4          1  0  79  468  1523            2  4          1  5  37  246  1089            1  2          4 `

 Posted by Charlie on 2012-05-18 15:16:23

 Search: Search body:
Forums (0)