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.

A058665 a(n) = gcd(n+1, n-phi(n)).

Original entry on oeis.org

2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1
Offset: 1

Views

Author

Labos Elemer, Dec 28 2000

Keywords

Comments

a(n) = 1 for most n. True for all primes and other integers.

Examples

			n = 247 = 13*19, n+1 = 248 = 8*31, phi(247) = 12*18 = 216, cototient(247) = 247-216 = 31, so a(247) = gcd(248,31) = 31.
		

Crossrefs

Programs

  • Mathematica
    Table[GCD[n+1,n-EulerPhi[n]],{n,0,110}] (* Harvey P. Dale, Dec 24 2012 *)
  • PARI
    A058665(n) = gcd(n+1, n-eulerphi(n)); \\ Antti Karttunen, Jul 28 2017
    
  • Python
    from sympy import gcd, totient
    def a(n): return gcd(n + 1, n - totient(n))
    print([a(n) for n in range(1, 51)]) # Indranil Ghosh, Jul 29 2017

Formula

a(n) = gcd(n+1, cototient(n)) = gcd(n+1, A051953(n)).

Extensions

Offset corrected by Antti Karttunen, Jul 28 2017