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

 THREE Triangular Numbers (Posted on 2008-10-21)
Tom, Dick and Harry each chose a different 5-digit triangular number whose digits fell into the pattern THREE, where each different letter represents a different base-10 digit.

Dick's triangular number had no digit in common with either Tom's or Harry's.

What was Dick's number? What two triangular numbers did the other two choose?

 Submitted by Charlie Rating: 2.0000 (1 votes) Solution: (Hide) The only 5-digit triangular numbers of the form THREE are: ```15400 17955 27966 40755 58311 75466 79800 84255 95266 ``` Only 27966 consists of digits such that two of the other numbers contain no digits in common with it, and therefore 27966 is Dick's number, with 15400 and 58311 being the other two numbers. ```adder = 1 DO triNum = triNum + adder adder = adder + 1 n\$ = LTRIM\$(STR\$(triNum)) IF LEN(n\$) = 5 THEN IF INSTR(2, n\$, MID\$(n\$, 1, 1)) = 0 THEN IF INSTR(3, n\$, MID\$(n\$, 2, 1)) = 0 THEN IF INSTR(4, n\$, MID\$(n\$, 3, 1)) = 0 THEN IF MID\$(n\$, 4, 1) = MID\$(n\$, 5, 1) THEN PRINT n\$ ct = ct + 1: tn\$(ct) = n\$ END IF END IF END IF END IF END IF LOOP UNTIL LEN(n\$) > 5 PRINT FOR i = 1 TO ct goodCt = 0 REDIM m\$(10) FOR j = 1 TO ct good = 1 FOR k = 1 TO 5 IF INSTR(tn\$(j), MID\$(tn\$(i), k, 1)) > 0 THEN good = 0: EXIT FOR NEXT IF good THEN goodCt = goodCt + 1: m\$(goodCt) = tn\$(j) NEXT IF goodCt > 1 THEN PRINT tn\$(i), FOR j = 1 TO goodCt PRINT m\$(j), NEXT PRINT END IF NEXT i ``` Adapted from Enigma No. 1510, "Triangular threesome", by Richard England, New Scientist, 6 September 2008.

 Subject Author Date Answer K Sengupta 2008-12-27 06:19:48 Solution Dej Mar 2008-10-22 06:50:50 Djck is between his friends Ady TZIDON 2008-10-21 20:09:00 No peaking... ed bottemiller 2008-10-21 12:45:28

 Search: Search body:
Forums (0)