OFFSET
1,2
COMMENTS
a(n) is the number of ways that the sum of n labeled 6-sided dice is divisible by 4. This is important for the game called Mahjong, where the remainder of the sum of n randomly rolled dice when divided by 4 determines the starting player. Usually n=3.
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (4,10,12).
FORMULA
a(n) = (1/4)*6^n + (2^(n/2-1))*cos(3*Pi*n/4).
a(n) = (1/4)*(6^n + (-1+i)^n + (-1-i)^n), where i is the imaginary unit.
a(n) = 4*a(n-1) + 10*a(n-2) + 12*a(n-3).
G.f.: x*(1 + 5*x + 9*x^2)/((1 - 6*x)*(1 + 2*x + 2*x^2)).
E.g.f.: (1/4)*exp(6*x) + cos(x)/(2*exp(x)) - 3/4.
Limit_{n->oo} a(n)/6^n = 1/4.
EXAMPLE
For n=2, (x + x^2 + x^3 + x^4 + x^5 + x^6)^2 = x^2 + 2*x^3 + 3*x^4 + 4*x^5 + 5*x^6 + 6*x^7 + 5*x^8 + 4*x^9 + 3*x^10 + 2*x^11 + x^12. So a(2) = 3 + 5 + 1 = 9.
MATHEMATICA
LinearRecurrence[{4, 10, 12}, {1, 9, 55}, 30] (* Paolo Xausa, Aug 30 2024 *)
PROG
(MATLAB) an=(6^n+(-1+1i)^n+(-1-1i)^n)/4
(PARI) a(n)=polcoef(lift(Mod(x+x^2+x^3+x^4+x^5+x^6, 1-x^4)^n), 0) \\ Andrew Howroyd, Apr 17 2023
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Yui Chit Chan, Apr 17 2023
STATUS
approved