A007667 The sum of both two and three consecutive squares.
5, 365, 35645, 3492725, 342251285, 33537133085, 3286296790925, 322023548377445, 31555021444198565, 3092070077983081805, 302991312620897818205, 29690056566770003102165
Offset: 1
Examples
a(2) = 365 = 13^2+14^2 = 10^2+11^2+12^2.
References
- M. Gardner, Time Travel and Other Mathematical Bewilderments. Freeman, NY, 1988, p. 22.
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..500
- Index entries for sequences related to sums of squares
- Index entries for linear recurrences with constant coefficients, signature (99,-99,1).
Programs
-
GAP
a:=[5, 365, 35645];; for n in [4..20] do a[n]:=99*a[n-1]-99*a[n-2] + a[n-3]; od; a; # G. C. Greubel, Jul 23 2019
-
Magma
R
:=PowerSeriesRing(Integers(), 20); Coefficients(R!( 5*x*(1-26*x+x^2)/((1-x)*(1-98*x+x^2)) )); // G. C. Greubel, Jul 23 2019 -
Mathematica
CoefficientList[Series[5*(1-26*x+x^2)/((1-x)*(1-98*x+x^2)),{x,0,20}],x] (* Vincenzo Librandi, Apr 16 2012 *) LinearRecurrence[{99,-99,1},{5,365,35645},20] (* Harvey P. Dale, Dec 10 2024 *)
-
PARI
my(x='x+O('x^20)); Vec(5*x*(1-26*x+x^2)/((1-x)*(1-98*x+x^2))) \\ G. C. Greubel, Jul 23 2019
-
Sage
(5*x*(1-26*x+x^2)/((1-x)*(1-98*x+x^2))).series(x, 20).coefficients(x, sparse=False) # G. C. Greubel, Jul 23 2019
Formula
From Ignacio Larrosa CaƱestro, Feb 27 2000: (Start)
a(n) = (b(n)-1)^2 + b(n)^2 + (b(n)+1)^2 = c(n)^2 + (c(n)+1)^2, where b(n) = A054320(n) and c(n) = A031138(n).
a(n) = 3*A006061(n) + 2.
a(n) = 99*(a(n-1) - a(n-2)) + a(n-3).
a(n) = 3*(5 - 2*sqrt(6))/8*(sqrt(3) + sqrt(2))^(4*n) + 3*(5 + 2*sqrt(6))/8*(sqrt(3) - sqrt(2))^(4*n) + 5/4. (End)
G.f.: 5*x*(1-26*x+x^2)/((1-x)*(1-98*x+x^2)). - Colin Barker, Apr 14 2012
Extensions
Corrected by T. D. Noe, Nov 07 2006