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

 Pandigital Squares II (Posted on 2008-03-15)
Adrian asked some friends to each make up a list of four perfect squares greater than zero, each having no more than four digits, that together use all ten digits exactly once.

Alice's and Brian's lists contained exactly two squares in common. Carol's list had no square in common with either Alice's or Brian's. David found a different set.

What was Carol's list and what was David's list?

 Submitted by Charlie Rating: 1.0000 (1 votes) Solution: (Hide) The only possible lists are: 1, 36, 784, 9025 9, 16, 784, 3025 9, 81, 324, 7056 9, 81, 576, 2304 Only the last two share two squares (9 and 81), so they must be Alice's and Brian's, but we don't know which is which. The second list shares a number with those two, and so can't be Carol's list. So Carol's list must be the first one, and David's is the second. OPEN "squarely.txt" FOR OUTPUT AS #2 DIM sq(100) FOR i = 1 TO 99 sq(i) = i * i NEXT FOR a = 1 TO 96 s1\$ = LTRIM\$(STR\$(sq(a))) FOR b = a + 1 TO 97 s2\$ = s1\$ + LTRIM\$(STR\$(sq(b))) FOR c = b + 1 TO 98 s3\$ = s2\$ + LTRIM\$(STR\$(sq(c))) IF LEN(s3\$) >= 6 AND LEN(s3\$) <= 9 THEN s4\$ = s3\$ + LTRIM\$(STR\$(sq(d))) IF LEN(s4\$) = 10 THEN REDIM had(9): good = 1 FOR i = 1 TO 10 v = VAL(MID\$(s4\$, i, 1)) IF had(v) THEN good = 0: EXIT FOR had(v) = 1 NEXT IF good THEN PRINT sq(a); sq(b); sq(c); sq(d) PRINT #2, sq(a); sq(b); sq(c); sq(d) END IF END IF NEXT END IF NEXT NEXT NEXT Based on Enigma No. 1478, "Yours squarely", by Adrian Somerfield, New Scientist, 26 January 2008.

 Subject Author Date Answer K Sengupta 2009-01-01 16:20:47 Computer solution Eigenray 2008-03-17 01:28:10

 Search: Search body:
Forums (45)