Let A, B, C, D be the number of chocolates each of the four people receive.
For example, A could receive all 12 chocolates so (12,0,0,0) would represent how many chocolates each receive. But we could also have (0,12,0,0), (0,0,12,0), (0,0,0,12). Therefore there are 4 different ways one person could have all the chocolates. However, (3,3,3,3) is the only way each person could receive 3 chocolates.
We need to see how many ways we can distribute 12 chocolates:
0,0,0,12; 0,0,1,11; ...; 0,0,11,1; 0,0,12,0; (13 of these)
0,1,0,11; 0,1,1,10; ...; 0,1,10,1; 0,0,11,0; (12 of these)
0,2,0,10; 0,2,1,9; ...; 0,2,9,1; 0,2,10,0; (11 of these)
0,3,0,9; ...; (10 of these)
0,4,0,8; 0,4,1,7; 0,4,2,6; 0,4,3,5; 0,4,4,4; 0,4,5,3; 0,4,6,2; 0,4,7,1; 0,4,8,0 (9 of these)
...
0,10,0,2; 0,10,1,1; 0,10,2,0; (3 of these)
0,11,0,1; 0,11,1,0; (2 of these)
0,12,0,0; (1 of these)
Total for 0,B,C,D = 13+12+...+1=13×14/2=91
1,0,0,11; 1,0,1,10; ...; 1,0,11,0 (12 of these)
1,1,0,10; 1,1,1,9; ...; 1,1,10,0; (11 of these)
...
1,10,0,1; 1,10,1,0; (2 of these)
1,11,0,0; (1 of these)
Total for 1,B,C,D = 12+11+...+1=12×13/2=78.
For 2,B,C,D the total = 11×12/2=66.
...
For 11,B,C,D the total = 2×3/2=3
For 12,B,C,D the total = 1×2/2=1 that is, 12,0,0,0.
The total number of permutations = 91+78+66+...+1.
We now need a formula to give us the number of permutations. Let's look at the series starting at the smallest term:
1×2/2+2×3/2+3×4/2+4×5/2+...+13×14/2=
1+3+6+10+...+66+78+91.
We can guess that the sum of this series is Sn=an3+bn2+cn+d, where a, b, c, d are constants. But we know that when n=0 S0=0, because there is no sum before n=1. So d=0 and we only need 3 equations to find 3 unknowns.
S1=1, S2=1+3=4, S3=1+3+6=10, S4=1+3+6+10=20 giving us 4 equations:
(1) a+b+c=1 (for n=1)
(2) 8a+4b+2c=4 (for n=2)
(3) 27a+9b+3c=10 (for n=3)
(4)=(2)-2(1): 6a+2b=2
(5)=(3)-3(1): 24a+6b=7
(6)=(5)-3(4): 6a=1, a=⅙, so b from (4) =1-3a=½, and c=1-(a+b)=1-⅔=⅓.
Therefore Sn=⅙n3+½n2+⅓n.
Let's check the formula by plugging in n=4: 64/6+16/2+4/3=32/3+8+4/3=20=S4. The formula seems to be OK, and we can plug in other values for n to prove it.
When n=13 we get the number of permutations of chocolates: S13=455.