%I #28 Sep 08 2022 08:45:32
%S 0,1,8,8,17,19,30,34,47,53,68,76,93,103,122,134,155,169,192,208,233,
%T 251,278,298,327,349,380,404,437,463,498,526,563,593,632,664,705,739,
%U 782,818,863,901,948,988,1037,1079,1130,1174,1227,1273,1328,1376,1433,1483
%N Sequence where the sum of each pair of consecutive elements is a square.
%C This covers squares of all consecutively increasing integers with the exception of 2.
%C It is actually possible to cover all nonnegative integers by using the given formula starting with n=-2, thus giving terms 2, -2, 3, 1, 8, 8, 17, 19, 30, etc. - _Vladimir Joseph Stephan Orlovsky_, Feb 12 2015
%H Vincenzo Librandi, <a href="/A135405/b135405.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,-2,1).
%F a(n) = (n+2)*(n+1)/2 + 2*(-1)^n for n>0.
%F From _R. J. Mathar_, Dec 12 2007: (Start)
%F O.g.f.: x*(1 +6*x -8*x^2 +3*x^3)/((1-x)^3*(1+x)) = -3 +1/(1-x)^3 + 2/(1+x).
%F a(n) = A000217(n+1) + 2*(-1)^n if n>0.
%F (End)
%F E.g.f.: -3 + 2*exp(-x) + (1/2)*(2 + 4*x + x^2)*exp(x). - _G. C. Greubel_, Oct 12 2016
%F From _Colin Barker_, Oct 13 2016: (Start)
%F a(n) = (-4*(-1)^n+n+n^2)/2 for n>1.
%F a(n) = 2*a(n-1)-2*a(n-3)+a(n-4) for n>4.
%F (End)
%e a(1) = 1 because 0 + 1 = 1^2.
%e a(2) = 8 because 1 + 8 = 9 = 3^2.
%e a(3) = 8 because 8 + 8 = 16 = 4^2.
%t a=1; lst={0, a}; Do[a=n^2-a; AppendTo[lst, a], {n, 3, 5!}]; lst (* _Vladimir Joseph Stephan Orlovsky_, Dec 17 2008 *)
%t Table[(n+2)*(n+1)/2 + 2*(-1)^n, {n,0,25}] (* _G. C. Greubel_, Oct 12 2016 *)
%o (Magma) [0] cat [(n+2)*(n+1)/2+2*(-1)^n: n in [1..60]]; // _Vincenzo Librandi_, Feb 14 2015
%o (PARI) concat(0, Vec(x*(1+6*x-8*x^2+3*x^3)/((1-x)^3*(1+x)) + O(x^60))) \\ _Colin Barker_, Oct 13 2016
%K nonn,easy
%O 0,3
%A _Alexander R. Povolotsky_, Dec 11 2007, Apr 02 2008
%E More terms from _Vladimir Joseph Stephan Orlovsky_, Dec 17 2008
|