CLS
FOR x = 1 TO 20
FOR y = 1 TO 20
tot = 13 + x + y
ct2 = 0
REDIM amt(tot)
FOR i = 1 TO 13: amt(i) = 1: NEXT
amt(x) = amt(x) + 1
amt(y) = amt(y) + 1
amt(x + y) = amt(x + y) + 1
amt(x + 2) = amt(x + 2) + 1
amt(x + 3) = amt(x + 3) + 1
amt(x + 8) = amt(x + 8) + 1
amt(x + 9) = amt(x + 9) + 1
amt(x + 7) = amt(x + 7) + 1
amt(x + 12) = amt(x + 12) + 1
amt(x + 13) = amt(x + 13) + 1
amt(y + 6) = amt(y + 6) + 1
amt(y + 10) = amt(y + 10) + 1
amt(y + 11) = amt(y + 11) + 1
amt(y + 12) = amt(y + 12) + 1
amt(y + 9) = amt(y + 9) + 1
amt(y + 13) = amt(y + 13) + 1
amt(y + 8) = amt(y + 8) + 1
amt(x + y + 2) = amt(x + y + 2) + 1
amt(x + y + 3) = amt(x + y + 3) + 1
amt(x + y + 8) = amt(x + y + 8) + 1
amt(x + y + 9) = amt(x + y + 9) + 1
amt(x + y + 7) = amt(x + y + 7) + 1
amt(x + y + 13) = amt(x + y + 13) + 1
amt(x + y + 12) = amt(x + y + 12) + 1
amt(x + y + 6) = amt(x + y + 6) + 1
amt(x + y + 10) = amt(x + y + 10) + 1
amt(x + y + 11) = amt(x + y + 11) + 1
good = 1
FOR i = 1 TO tot
IF amt(i) = 0 OR amt(i) > 2 THEN good = 0: EXIT FOR
IF amt(i) = 2 THEN ct2 = ct2 + 1
NEXT
IF good THEN
PRINT x; y,
FOR i = 1 TO tot
PRINT amt(i);
NEXT
PRINT : PRINT "*"; ct2
END IF
NEXT
NEXT
finds x=7,y=8 and x=15,y=8 as the only two sets of values for which any given value has only one or two ways of being achieved, but the former has 12 values that could be achieved in two ways, so the latter, (x=15,y=8), has the four such values as sought: 8, 17, 18 and 23.
The search set could have been narrowed down to where N=36, so that x+y=23, by the following reasoning:
There are 6 single-stamp sets.
There are 7 2-stamp sets.
There are 10 3-stamp sets.
There are 10 4-stamp sets.
There are 6 5-stamp sets.
There is 1 6-stamp set.
This adds up to 40 sets. Given that exactly four totals are represented by two sets each, that means there are 36 different totals achievable and therefore the total of all the stamps is 36.
From Enigma No. 1596, "Semi-detached", by Bob Walker, New Scientist, 22 May 2010, page 28.
|