3 jealous brothers are to divvy up a set of commemorative coins.
There are an equal number (n) of coins of each of the values: $1, $2, $3.
For each of the numbers n = 1 to 8
determine in how many ways it is possible to divide the set of coins in such a way that each brother gets the same number of coins and the same total value of coins.
Do not count permutations of the brothers separately. Just count the breakdowns.
Note 1: Please avoid the temptation to look this sequence up. It will give away a surprise.
Note 2: I would prefer you not do this with a computer program.
no. of coins numbers of coins by brother soln count
------------ ----------------------------------- within set
per
den total $1 $2 $3 $1 $2 $3 $1 $2 $3
2 6 0 2 0 1 0 1 1 0 1
1
3 9 1 1 1 1 1 1 1 1 1
1
4 12 0 4 0 2 0 2 2 0 2
4 12 1 2 1 1 2 1 2 0 2
2
5 15 1 3 1 2 1 2 2 1 2
1
6 18 0 6 0 3 0 3 3 0 3
6 18 1 4 1 2 2 2 3 0 3
6 18 2 2 2 2 2 2 2 2 2
3
7 21 1 5 1 3 1 3 3 1 3
7 21 2 3 2 2 3 2 3 1 3
2
8 24 0 8 0 4 0 4 4 0 4
8 24 1 6 1 3 2 3 4 0 4
8 24 2 4 2 2 4 2 4 0 4
8 24 2 4 2 3 2 3 3 2 3
4
9 27 1 7 1 4 1 4 4 1 4
9 27 2 5 2 3 3 3 4 1 4
9 27 3 3 3 3 3 3 3 3 3
3
10 30 0 10 0 5 0 5 5 0 5
10 30 1 8 1 4 2 4 5 0 5
10 30 2 6 2 3 4 3 5 0 5
10 30 2 6 2 4 2 4 4 2 4
10 30 3 4 3 3 4 3 4 2 4
5
11 33 1 9 1 5 1 5 5 1 5
11 33 2 7 2 4 3 4 5 1 5
11 33 3 5 3 3 5 3 5 1 5
11 33 3 5 3 4 3 4 4 3 4
4
12 36 0 12 0 6 0 6 6 0 6
12 36 1 10 1 5 2 5 6 0 6
12 36 2 8 2 4 4 4 6 0 6
12 36 2 8 2 5 2 5 5 2 5
12 36 3 6 3 3 6 3 6 0 6
12 36 3 6 3 4 4 4 5 2 5
12 36 4 4 4 4 4 4 4 4 4
7
13 39 1 11 1 6 1 6 6 1 6
13 39 2 9 2 5 3 5 6 1 6
13 39 3 7 3 4 5 4 6 1 6
13 39 3 7 3 5 3 5 5 3 5
13 39 4 5 4 4 5 4 5 3 5
5
14 42 0 14 0 7 0 7 7 0 7
14 42 1 12 1 6 2 6 7 0 7
14 42 2 10 2 5 4 5 7 0 7
14 42 2 10 2 6 2 6 6 2 6
14 42 3 8 3 4 6 4 7 0 7
14 42 3 8 3 5 4 5 6 2 6
14 42 4 6 4 4 6 4 6 2 6
14 42 4 6 4 5 4 5 5 4 5
8
15 45 1 13 1 7 1 7 7 1 7
15 45 2 11 2 6 3 6 7 1 7
15 45 3 9 3 5 5 5 7 1 7
15 45 3 9 3 6 3 6 6 3 6
15 45 4 7 4 4 7 4 7 1 7
15 45 4 7 4 5 5 5 6 3 6
15 45 5 5 5 5 5 5 5 5 5
7
16 48 0 16 0 8 0 8 8 0 8
16 48 1 14 1 7 2 7 8 0 8
16 48 2 12 2 6 4 6 8 0 8
16 48 2 12 2 7 2 7 7 2 7
16 48 3 10 3 5 6 5 8 0 8
16 48 3 10 3 6 4 6 7 2 7
16 48 4 8 4 4 8 4 8 0 8
16 48 4 8 4 5 6 5 7 2 7
16 48 4 8 4 6 4 6 6 4 6
16 48 5 6 5 5 6 5 6 4 6
10
17 51 1 15 1 8 1 8 8 1 8
17 51 2 13 2 7 3 7 8 1 8
17 51 3 11 3 6 5 6 8 1 8
17 51 3 11 3 7 3 7 7 3 7
17 51 4 9 4 5 7 5 8 1 8
17 51 4 9 4 6 5 6 7 3 7
17 51 5 7 5 5 7 5 7 3 7
17 51 5 7 5 6 5 6 6 5 6
8
18 54 0 18 0 9 0 9 9 0 9
18 54 1 16 1 8 2 8 9 0 9
18 54 2 14 2 7 4 7 9 0 9
18 54 2 14 2 8 2 8 8 2 8
18 54 3 12 3 6 6 6 9 0 9
18 54 3 12 3 7 4 7 8 2 8
18 54 4 10 4 5 8 5 9 0 9
18 54 4 10 4 6 6 6 8 2 8
18 54 4 10 4 7 4 7 7 4 7
18 54 5 8 5 5 8 5 8 2 8
18 54 5 8 5 6 6 6 7 4 7
18 54 6 6 6 6 6 6 6 6 6
12
19 57 1 17 1 9 1 9 9 1 9
19 57 2 15 2 8 3 8 9 1 9
19 57 3 13 3 7 5 7 9 1 9
19 57 3 13 3 8 3 8 8 3 8
19 57 4 11 4 6 7 6 9 1 9
19 57 4 11 4 7 5 7 8 3 8
19 57 5 9 5 5 9 5 9 1 9
19 57 5 9 5 6 7 6 8 3 8
19 57 5 9 5 7 5 7 7 5 7
19 57 6 7 6 6 7 6 7 5 7
10
20 60 0 20 0 10 0 10 10 0 10
20 60 1 18 1 10 0 10 9 2 9
20 60 2 16 2 9 2 9 9 2 9
20 60 3 14 3 8 4 8 9 2 9
20 60 4 12 4 7 6 7 9 2 9
20 60 4 12 4 8 4 8 8 4 8
20 60 5 10 5 6 8 6 9 2 9
20 60 5 10 5 7 6 7 8 4 8
20 60 6 8 6 6 8 6 8 4 8
20 60 6 8 6 7 6 7 7 6 7
20 60 10 0 10 2 16 2 8 4 8
20 60 10 0 10 3 14 3 7 6 7
20 60 10 0 10 4 12 4 6 8 6
20 60 10 0 10 5 10 5 5 10 5
14
So for 1 through 8, respectively, the counts of ways are equal to 0, 1, 1, 2, 1, 3, 2, 4.
The series continues with 3, 5, 4, 7, 5, 8, 7, 10, 8, 12, 10, 14.
This can be identified as Alcuin's sequence, A005044 in Sloane's OEIS, or at least the terms of that sequence after the first four members are dropped.
Sloane states that sequence's members can be found from:
For all n, a(n) = round(n^2/12)-floor(n/4)*floor((n+2)/4)
but remember that n is our n + 4 so we could change that to
round((n+4)^2/12) - floor((n+4)/4) * floor((n+6)/4)
except they included a zeroth term so the following actually works:
round((n + 3) ^ 2 / 12) - floor((n + 3) / 4) * floor((n + 5) / 4)
The only significant change from the original Commemorations program was the addition of the equal signs in the line, as different brothers' allocations can now be the same:
IF a$ <= b$ AND b$ <= c$ THEN
CLS
FOR n = 1 TO 100
value = 6 * n
coins = 3 * n
valeach = 2 * n
coinseach = n
FOR a1 = 0 TO n
FOR a2 = 0 TO n - a1
a3 = n - a1 - a2
vala = a1 + 2 * a2 + 3 * a3
IF vala = valeach THEN
FOR b1 = 0 TO n - a1
FOR b2 = 0 TO n - a2
IF b1 + b2 <= coinseach THEN
b3 = n - b1 - b2
IF a3 + b3 <= n THEN
valb = b1 + 2 * b2 + 3 * b3
IF valb = valeach THEN
c1 = n - a1 - b1
c2 = n - a2 - b2
c3 = n - a3 - b3
a$ = STR$(a1) + STR$(a2) + STR$(a3)
b$ = STR$(b1) + STR$(b2) + STR$(b3)
c$ = STR$(c1) + STR$(c2) + STR$(c3)
IF a$ <= b$ AND b$ <= c$ THEN
IF n <> prevn THEN PRINT TAB(52); subCt: subCt = 0: ct = ct + 1
PRINT n; 3 * n, a1; a2; a3, b1; b2; b3, c1; c2; c3
prevn = n
ct = ct + 1: subCt = subCt + 1
END IF
END IF
END IF
END IF
NEXT
NEXT
END IF
NEXT a2
NEXT a1
IF ct > 120 THEN PRINT TAB(52); subCt: END
NEXT n
|
Posted by Charlie
on 2013-02-11 18:54:33 |