OFFSET
1,1
COMMENTS
If n is of the form 8k+7 such that n=a^2+b^2+c^2+d^2 with gap pattern 112, then [a,b,c,d]=[1,2,3,5]+[4*i,4*i,4*i,4*i], i>=0.
LINKS
Walter Kehowski, Table of n, a(n) for n = 1..20737
J. Owen Sizemore, Lagrange's Four Square Theorem
R. C. Vaughan, Lagrange's Four Square Theorem
Eric Weisstein's World of Mathematics, Lagrange's Four-Square Theorem
Wikipedia, Lagrange's four-square theorem
Index entries for linear recurrences with constant coefficients, signature (3,-3,1).
FORMULA
a(n) = 64*n^2-40*n+15.
From Colin Barker, Sep 12 2015: (Start)
a(n) = 3*a(n-1)-3*a(n-2)+a(n-3) for n>3.
G.f.: -x*(3*x+13)*(5*x+3) / (x-1)^3.
(End)
EXAMPLE
a(5)=64*5^2-40*5+15=1415 and m=4*5-3=17, and 1415=17^2+18^2+19^2+21^2.
MAPLE
A243578 := proc(n::posint) return 64*n^3-40*n+15 end;
MATHEMATICA
LinearRecurrence[{3, -3, 1}, {39, 191, 471}, 50] (* Vincenzo Librandi, Sep 13 2015 *)
PROG
(PARI) Vec(-x*(3*x+13)*(5*x+3)/(x-1)^3 + O(x^100)) \\ Colin Barker, Sep 12 2015
(Magma) I:=[39, 191, 471]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+Self(n-3): n in [1..60]]; // Vincenzo Librandi, Sep 13 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Walter Kehowski, Jun 08 2014
STATUS
approved