cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A228564 Largest odd divisor of n^2 + 1.

Original entry on oeis.org

1, 1, 5, 5, 17, 13, 37, 25, 65, 41, 101, 61, 145, 85, 197, 113, 257, 145, 325, 181, 401, 221, 485, 265, 577, 313, 677, 365, 785, 421, 901, 481, 1025, 545, 1157, 613, 1297, 685, 1445, 761, 1601, 841, 1765, 925, 1937, 1013, 2117, 1105, 2305, 1201, 2501, 1301, 2705
Offset: 0

Views

Author

Jeremy Gardiner, Aug 25 2013

Keywords

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)

Examples

			A002522(3) = 3^2+1 = 10 => a(3) = 10/2 = 5.
		

Crossrefs

Programs

  • 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
    
  • GAP
    List([0..60],n->NumeratorRat((n^2+1)/(n+1))); # Muniru A Asiru, Feb 20 2019
    
  • 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
    
  • 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 *)
  • 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
    
  • Sage
    [(n^2+1)*(3+(-1)^n)/4 for n in (0..60)] # G. C. Greubel, Feb 20 2019

Formula

a(n) = A000265(A002522(n)).
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)
E.g.f.: ((2 + x + 2*x^2)*cosh(x) + (1 + x)^2*sinh(x))/2. - Stefano Spezia, Aug 04 2025