A wealthy man had three sons all of whom were quite good at math and logic. To get a share of his inheritance each had to correctly determine a positive integer which he had chosen. He told them that the number had four different non-zero decimal digits, in ascending order.
He prepared three sealed envelopes each of which contained a number. The first contained the product of the four digits, the second contained the sum of the squares of the four digits, the third contained the sum of the product of the first two digits and the product of the last two digits, and the envelopes were clearly marked as such. He showed the three envelopes to the three sons and had them each take one at random. Each one saw the number inside his envelope but didn't see the number inside the other two envelopes.
The sons were stationed at three different computers so that they couldn't communicate with one another (but were linked to the father's computer). After one hour they could submit a number or decline. Anyone who submitted a wrong answer would be eliminated and get nothing. If one or more submitted the correct answer they would each receive a share of the inheritance, and the contest would end with the others getting nothing. If no one submitted the correct answer they would be instructed to work on the problem for another hour. The process would repeat as often as necessary. Each of the sons decided not to submit an answer unless they sure it was correct.
At the end of the first hour no one had submitted an answer.
At the end of the second hour no one had submitted an answer.
At the end of the third hour no one had submitted an answer.
At the end of the fourth hour all three of them submitted the correct answer!
Can you determine the number?
There are 126 numbers that meet the original criteria:
1234 24 30 14
1235 30 39 17
1236 36 50 20
1237 42 63 23
1238 48 78 26
1239 54 95 29
1245 40 46 22
1246 48 57 26
1247 56 70 30
1248 64 85 34
1249 72 102 38
1256 60 66 32
1257 70 79 37
1258 80 94 42
1259 90 111 47
1267 84 90 44
1268 96 105 50
1269 108 122 56
1278 112 118 58
1279 126 135 65
1289 144 150 74
1345 60 51 23
1346 72 62 27
1347 84 75 31
1348 96 90 35
1349 108 107 39
1356 90 71 33
1357 105 84 38
1358 120 99 43
1359 135 116 48
1367 126 95 45
1368 144 110 51
1369 162 127 57
1378 168 123 59
1379 189 140 66
1389 216 155 75
1456 120 78 34
1457 140 91 39
1458 160 106 44
1459 180 123 49
1467 168 102 46
1468 192 117 52
1469 216 134 58
1478 224 130 60
1479 252 147 67
1489 288 162 76
1567 210 111 47
1568 240 126 53
1569 270 143 59
1578 280 139 61
1579 315 156 68
1589 360 171 77
1678 336 150 62
1679 378 167 69
1689 432 182 78
1789 504 195 79
2345 120 54 26
2346 144 65 30
2347 168 78 34
2348 192 93 38
2349 216 110 42
2356 180 74 36
2357 210 87 41
2358 240 102 46
2359 270 119 51
2367 252 98 48
2368 288 113 54
2369 324 130 60
2378 336 126 62
2379 378 143 69
2389 432 158 78
2456 240 81 38
2457 280 94 43
2458 320 109 48
2459 360 126 53
2467 336 105 50
2468 384 120 56
2469 432 137 62
2478 448 133 64
2479 504 150 71
2489 576 165 80
2567 420 114 52
2568 480 129 58
2569 540 146 64
2578 560 142 66
2579 630 159 73
2589 720 174 82
2678 672 153 68
2679 756 170 75
2689 864 185 84
2789 1008 198 86
3456 360 86 42
3457 420 99 47
3458 480 114 52
3459 540 131 57
3467 504 110 54
3468 576 125 60
3469 648 142 66
3478 672 138 68
3479 756 155 75
3489 864 170 84
3567 630 119 57
3568 720 134 63
3569 810 151 69
3578 840 147 71
3579 945 164 78
3589 1080 179 87
3678 1008 158 74
3679 1134 175 81
3689 1296 190 90
3789 1512 203 93
4567 840 126 62
4568 960 141 68
4569 1080 158 74
4578 1120 154 76
4579 1260 171 83
4589 1440 186 92
4678 1344 165 80
4679 1512 182 87
4689 1728 197 96
4789 2016 210 100
5678 1680 174 86
5679 1890 191 93
5689 2160 206 102
5789 2520 219 107
6789 3024 230 114
Shown are the number, the product of the digits, the sum of the squares of the digits, and the sum of the pairwise products of the first two and last two.
Of the above 43 numbers have all three derived quantities that are non-unique:
1238 48 78 26
1249 72 102 38
1259 90 111 47
1267 84 90 44
1268 96 105 50
1289 144 150 74
1358 120 99 43
1368 144 110 51
1378 168 123 59
1389 216 155 75
1456 120 78 34
1467 168 102 46
1469 216 134 58
1567 210 111 47
1568 240 126 53
1569 270 143 59
1678 336 150 62
1689 432 182 78
2347 168 78 34
2349 216 110 42
2358 240 102 46
2359 270 119 51
2378 336 126 62
2379 378 143 69
2389 432 158 78
2457 280 94 43
2459 360 126 53
2467 336 105 50
2479 504 150 71
2489 576 165 80
2567 420 114 52
2679 756 170 75
3457 420 99 47
3458 480 114 52
3467 504 110 54
3479 756 155 75
3489 864 170 84
3567 630 119 57
3578 840 147 71
3678 1008 158 74
4567 840 126 62
4569 1080 158 74
4679 1512 182 87
(They may be unique in one or two columns in the listing immediately above, as the match might be with a number that has some other column with a unique value.)
Then the second round takes place and we are down to only those that have all three non-unique values in this list. There are 22 such numbers:
1289 144 150 74
1358 120 99 43
1368 144 110 51
1389 216 155 75
1456 120 78 34
1467 168 102 46
1568 240 126 53
1569 270 143 59
1678 336 150 62
1689 432 182 78
2347 168 78 34
2358 240 102 46
2359 270 119 51
2378 336 126 62
2389 432 158 78
2467 336 105 50
2479 504 150 71
2567 420 114 52
2679 756 170 75
3457 420 99 47
3479 756 155 75
4567 840 126 62
Then, repeating for the third round, there are 7:
1456 120 78 34
1467 168 102 46
1678 336 150 62
2347 168 78 34
2358 240 102 46
2378 336 126 62
3479 756 155 75
We know that after this, all three announced the answer, so it must be 3479, which is the only one with all unique values among those remaining.
DEFDBL A-Z
DIM n(126), p(126), ssq(126), s2(126)
OPEN "inherit.txt" FOR OUTPUT AS #2
FOR d1 = 1 TO 6
FOR d2 = d1 + 1 TO 7
FOR d3 = d2 + 1 TO 8
FOR d4 = d3 + 1 TO 9
i = i + 1
n(i) = d1 * 1000 + d2 * 100 + d3 * 10 + d4
p(i) = d1 * d2 * d3 * d4
ssq(i) = d1 * d1 + d2 * d2 + d3 * d3 + d4 * d4
s2(i) = d1 * d2 + d3 * d4
ct = ct + 1
NEXT
NEXT
NEXT
NEXT
PRINT #2, ct
FOR i = 1 TO ct
PRINT #2, n(i), p(i), ssq(i), s2(i)
NEXT
PRINT #2,
REDIM multi(3, ct)
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF p(i) = p(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(1, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF ssq(i) = ssq(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(2, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF s2(i) = s2(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(3, i) = 1
NEXT
newCt = 0
FOR i = 1 TO ct
IF multi(1, i) AND multi(2, i) AND multi(3, i) THEN
newCt = newCt + 1
n(newCt) = n(i): p(newCt) = p(i): ssq(newCt) = ssq(i): s2(newCt) = s2(i)
END IF
NEXT
ct = newCt
PRINT #2, ct
FOR i = 1 TO ct
PRINT #2, n(i), p(i), ssq(i), s2(i)
NEXT
PRINT #2,
REDIM multi(3, ct)
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF p(i) = p(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(1, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF ssq(i) = ssq(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(2, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF s2(i) = s2(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(3, i) = 1
NEXT
newCt = 0
FOR i = 1 TO ct
IF multi(1, i) AND multi(2, i) AND multi(3, i) THEN
newCt = newCt + 1
n(newCt) = n(i): p(newCt) = p(i): ssq(newCt) = ssq(i): s2(newCt) = s2(i)
END IF
NEXT
ct = newCt
PRINT #2, ct
FOR i = 1 TO ct
PRINT #2, n(i), p(i), ssq(i), s2(i)
NEXT
PRINT #2,
REDIM multi(3, ct)
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF p(i) = p(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(1, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF ssq(i) = ssq(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(2, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF s2(i) = s2(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(3, i) = 1
NEXT
newCt = 0
FOR i = 1 TO ct
IF multi(1, i) AND multi(2, i) AND multi(3, i) THEN
newCt = newCt + 1
n(newCt) = n(i): p(newCt) = p(i): ssq(newCt) = ssq(i): s2(newCt) = s2(i)
END IF
NEXT
ct = newCt
PRINT #2, ct
FOR i = 1 TO ct
PRINT #2, n(i), p(i), ssq(i), s2(i)
NEXT
REDIM multi(3, ct)
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF p(i) = p(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(1, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF ssq(i) = ssq(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(2, i) = 1
NEXT
FOR i = 1 TO ct
t = 0
FOR j = 1 TO ct
IF s2(i) = s2(j) THEN t = t + 1
NEXT
IF t > 1 THEN multi(3, i) = 1
NEXT
newCt = 0
FOR i = 1 TO ct
IF (multi(1, i) OR multi(2, i) OR multi(3, i)) = 0 THEN
newCt = newCt + 1
n(newCt) = n(i): p(newCt) = p(i): ssq(newCt) = ssq(i): s2(newCt) = s2(i)
END IF
NEXT
ct = newCt
PRINT #2, ct
FOR i = 1 TO ct
PRINT #2, n(i), p(i), ssq(i), s2(i)
NEXT
PRINT #2,
|
Posted by Charlie
on 2004-12-25 01:18:08 |