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.

A272328 Number of integers 1<=k<=n such that phi(n)=phi(n+k) where phi is Euler's totient function A000010.

Original entry on oeis.org

1, 0, 2, 1, 2, 0, 2, 2, 2, 1, 1, 0, 2, 1, 4, 3, 2, 0, 2, 2, 4, 0, 1, 1, 3, 3, 2, 2, 1, 0, 1, 4, 3, 3, 5, 1, 3, 1, 6, 2, 3, 0, 2, 2, 7, 0, 1, 1, 2, 1, 5, 6, 1, 0, 5, 5, 5, 0, 1, 0, 4, 0, 5, 5, 4, 0, 1, 4, 2, 4, 1, 3, 6, 4, 6, 3, 5, 2, 1, 3, 1, 5, 1, 1, 4, 1, 2
Offset: 1

Views

Author

Tom Edgar, Apr 25 2016

Keywords

Comments

If n is odd, then phi(n) = phi(2n) so that a(n)>=1.
If n is a member of A043343, then a(n)=0.
It seems that every nonnegative integer appears in this sequence.

Examples

			For n=2: phi(2) = 1; whereas phi(2+1) = 2 and phi(2+2) = 2. Thus a(2) = 0.
For n=5: phi(5) = 4, phi(5+1)=2, phi(5+2)=6, phi(5+3) = 4, phi(5+4) = 6, and phi(5+5) = 4. Since phi(5) = phi(5+3) = phi(5+5), a(5) = 2.
		

Crossrefs

Programs

  • Mathematica
    Table[Count[Range@ n, k_ /; EulerPhi@ n == EulerPhi[n + k]], {n, 120}] (* Michael De Vlieger, Apr 25 2016 *)
  • PARI
    a(n) = my(x=eulerphi(n)); sum(k=1, n, eulerphi(n+k) == x); \\ Michel Marcus, Mar 08 2020
  • Python
    from sympy import totient
    nmax = 10**4
    philist = [totient(i) for i in range(1,2*nmax+1)]
    A272328_list = [philist[i+1:2*(i+1)].count(philist[i]) for i in range(nmax)] # Chai Wah Wu, Apr 26 2016
    
  • Sage
    [sum([1 for k in [1..n] if euler_phi(n)==euler_phi(n+k)]) for n in [1..1000]]