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.

A064814 Greatest common divisor of n and the n-th composite number.

Original entry on oeis.org

1, 2, 1, 1, 5, 6, 7, 1, 1, 2, 1, 3, 1, 2, 5, 2, 1, 2, 1, 4, 3, 2, 1, 12, 1, 13, 1, 14, 1, 15, 1, 16, 1, 2, 1, 4, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 4, 1, 10, 3, 2, 1, 2, 11, 2, 1, 1, 1, 12, 1, 2, 3, 8, 5, 1, 1, 1, 1, 5, 1, 2, 1, 2, 3, 4, 7, 2, 1, 10, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 31, 1, 1, 32, 1, 2
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 22 2001

Keywords

Comments

a(12) = gcd(12, A002808(12)) = gcd(12, 21) = gcd(2*2*3, 3*7) = 3.

Crossrefs

Programs

  • Mathematica
    Composite[n_Integer] := FixedPoint[n + PrimePi[#] + 1 &, n + PrimePi[n] + 1]; Table[GCD[n, Composite[n]], {n, 100}] (* T. D. Noe, Feb 22 2012 *)
    Module[{nn=150,comps},comps=Complement[Range[2,nn],Prime[Range[ PrimePi[ nn]]]];GCD@@@Thread[{comps,Range[Length[comps]]}]] (* Harvey P. Dale, Apr 23 2014 *)
  • PARI
    nextComp(n)= { if (!isprime(n), return(n)); return(n + 1) } { c=3; for (n=1, 1000, c=nextComp(c + 1); write("b064814.txt", n, " ", gcd(n, c)) ) } \\ Harry J. Smith, Sep 27 2009

Formula

a(n) = gcd(n, A002808(n)).