OFFSET
0,3
COMMENTS
From Lamine Ngom, Jan 04 2023: (Start)
For n>2, a(n) = hypotenuse c of the primitive Pythagorean triple (a, b, c) such that n*a = b + c.
Terms that appear twice (1, 5, 145, 4901, ...) are the positive terms of A076218. Equivalently, the products of two consecutive terms of A001653, or one more than the squares of A001542.
These duplicated terms appear at indices i and j (i>j) such that (i^2-1)/2 = j^2 (A001541). In addition, they are hypotenuse in two primitive Pythagorean triples: (i, j^2, a(i)) and (2*j, j^2-1, a(i)). (End)
LINKS
Jeremy Gardiner, Table of n, a(n) for n = 0..1000
Wikipedia, Quasi-polynomial.
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
From Ralf Stephan, Aug 26 2013: (Start)
a(4n) = 4*a(2n) - 3.
a(4n+1) = 2*a(2n) + 4*n - 1.
a(4n+2) = 4*a(2n) + 16*n + 1.
a(4n+3) = 2*a(2n) + 12*n + 3. (End)
From Bruno Berselli, Aug 26 2013: (Start)
G.f.: (1 + x + 2*x^2 + 2*x^3 + 5*x^4 + x^5) / (1-x^2)^3.
a(n) = 3*a(n-2) -3*a(n-4) +a(n-6).
a(n) = (n^2+1)*(3+(-1)^n)/4. (End)
From Peter Bala, Feb 14 2019: (Start)
a(n) = numerator((n^2 + 1)/(n + 1)).
a(n) is a quasi-polynomial in n: a(2*n) = 4*n^2 + 1; a(2*n + 1) = 2*n^2 + 2*n + 1. (End)
From Amiram Eldar, Aug 09 2022: (Start)
a(n) = numerator((n^2+1)/2).
Sum_{n>=0} 1/a(n) = (1 + coth(Pi/2)*Pi/2 + tanh(Pi/2)*Pi)/2. (End)
EXAMPLE
A002522(3) = 3^2+1 = 10 => a(3) = 10/2 = 5.
MAPLE
lod:= t -> t/2^padic:-ordp(t, 2):
seq(lod(n^2+1), n=0..60); # Robert Israel, Aug 19 2014
MATHEMATICA
Table[(n^2 + 1) (3 + (-1)^n)/4, {n, 0, 60}] (* Bruno Berselli, Aug 26 2013 *)
PROG
(BASIC)
for n = 0 to 45 : t=n^2+1
x: if not t mod 2 then t=t/2 : goto x
print str$(t); ", "; : next n
print
end
(PARI) a(n)=if(n<2, n>0, m=n\4; [4*a(2*m)-3, 2*a(2*m)+4*m-1, 4*a(2*m)+16*m+1, 2*a(2*m)+12*m+3][(n%4)+1]) \\ Ralf Stephan, Aug 26 2013
(PARI) a(n)=(n^2+1)/2^valuation(n^2+1, 2) \\ Ralf Stephan, Aug 26 2013
(Magma) [(n^2+1)*(3+(-1)^n)/4: n in [0..60]]; // Bruno Berselli, Aug 26 2013
(Magma) [Denominator(2*n^2/(n^2+1)): n in [0..60]]; // Vincenzo Librandi, Aug 19 2014
(GAP) List([0..60], n->NumeratorRat((n^2+1)/(n+1))); # Muniru A Asiru, Feb 20 2019
(Sage) [(n^2+1)*(3+(-1)^n)/4 for n in (0..60)] # G. C. Greubel, Feb 20 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jeremy Gardiner, Aug 25 2013
STATUS
approved