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.

A089146 Greatest common divisor of n^2 - 4 and n^2 + 4.

Original entry on oeis.org

4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4, 1, 8, 1, 4
Offset: 0

Views

Author

Cino Hilliard, Dec 05 2003

Keywords

Comments

Also decimal expansion of 4181/9999 = 0.418141814181...
Repeat [4,1,8,1], because for odd n, the GCD is 1; for n = 4k+2, GCD(16(k^2+k), 16(k^2+k)+8) = 8; for n = 4k, (16k^2-4,16k^2+4) can be divided by 4, but then GCD(4k^2-1,4k^2+1) = 1. - Georg Fischer, Jul 21 2022

Crossrefs

Programs

  • Mathematica
    a[n_] := GCD[n^2 - 4, n^2 + 4]; Array[a, 101, 0] (* Amiram Eldar, Dec 31 2022 *)
  • PARI
    g(n) = for(x=0,n,print1(gcd(x^2-4,x^2+4)","))

Formula

Multiplicative with a(2) = 8, a(2^e) = 4 if e >= 2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 12 2005
Dirichlet g.f.: zeta(s)*(1+7/2^s-4^(1-s)). - Amiram Eldar, Dec 31 2022
Sum_{k=1..n} a(k) ~ 7*n/2. - Vaclav Kotesovec, Dec 31 2022