login
a(n) = n^2 + 1 - (-1)^n.
1

%I #44 Aug 21 2022 04:18:50

%S 0,3,4,11,16,27,36,51,64,83,100,123,144,171,196,227,256,291,324,363,

%T 400,443,484,531,576,627,676,731,784,843,900,963,1024,1091,1156,1227,

%U 1296,1371,1444,1523,1600,1683,1764,1851,1936,2027,2116

%N a(n) = n^2 + 1 - (-1)^n.

%C Also, A016742 and A164897 interleaved.

%C See the spiral in Example field of A054552: after 0, the sequence is given by the terms of the semidiagonals 4, 16, 36, 64, 100, ... and 3, 11, 27, 51, 83, ... sorted into ascending order.

%C Primes of the sequence are in A056899.

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,-2,1).

%F a(n) = a(-n) = 2*a(n-1) - 2*(n-3) + a(n-4).

%F a(n) = n^2 + A010673(n) = (n+1)^2 - A168277(n+1).

%F a(n+1) = A248800(n) + A042963(n+1) = a(n) + A166519(n).

%F a(n+2) = a(n) + 4*n.

%F a(n+5) = a(n-5) + A008602(n).

%F G.f.: x*(3 - 2*x + 3*x^2)/((1 + x)*(1 - x)^3). - _Bruno Berselli_, Oct 15 2014

%F Sum_{n>=1} 1/a(n) = Pi^2/24 + tanh(Pi/sqrt(2))*Pi/(4*sqrt(2)). - _Amiram Eldar_, Aug 21 2022

%t Table[n^2 + 1 - (-1)^n, {n, 0, 60}] (* _Vincenzo Librandi_, Oct 16 2014 *)

%t LinearRecurrence[{2,0,-2,1},{0,3,4,11},60] (* _Harvey P. Dale_, Jun 30 2019 *)

%o (PARI) vector(100,n,(n-1)^2+1+(-1)^n) \\ _Derek Orr_, Oct 15 2014

%o (Magma) [n^2+1-(-1)^n: n in [0..60]]; // _Vincenzo Librandi_, Oct 16 2014

%o (Sage) [n^2+1-(-1)^n for n in (0..60)] # _Bruno Berselli_, Oct 16 2014

%Y Cf. A000290, A008586, A008602, A010673, A016742, A042963, A056899, A164897, A166519, A168277, A248800.

%K nonn,easy

%O 0,2

%A _Paul Curtz_, Oct 15 2014

%E Edited by _Bruno Berselli_, Oct 16 2014