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.

A047994 Unitary totient (or unitary phi) function uphi(n).

Original entry on oeis.org

1, 1, 2, 3, 4, 2, 6, 7, 8, 4, 10, 6, 12, 6, 8, 15, 16, 8, 18, 12, 12, 10, 22, 14, 24, 12, 26, 18, 28, 8, 30, 31, 20, 16, 24, 24, 36, 18, 24, 28, 40, 12, 42, 30, 32, 22, 46, 30, 48, 24, 32, 36, 52, 26, 40, 42, 36, 28, 58, 24, 60, 30, 48, 63, 48, 20, 66, 48, 44, 24, 70
Offset: 1

Views

Author

Keywords

Comments

A divisor d of n is called a unitary divisor if gcd(d, n/d) = 1. Define gcd*(k,n) to be the largest divisor d of k that is also a unitary divisor of n (that is, such that gcd(d, n/d) = 1). The unitary totient function a(n) = number of k with 1 <= k <= n such that gcd*(k,n) = 1. - N. J. A. Sloane, Aug 08 2021
Unitary convolution of A076479 and A000027. - R. J. Mathar, Apr 13 2011
Multiplicative with a(p^e) = p^e - 1. - N. J. A. Sloane, Apr 30 2013

Examples

			a(12) = a(3)*a(4) = 2*3 = 6.
		

Crossrefs

Programs

  • Haskell
    a047994 n = f n 1 where
       f 1 uph = uph
       f x uph = f (x `div` sppf) (uph * (sppf - 1)) where sppf = a028233 x
    -- Reinhard Zumkeller, Aug 17 2011
    
  • Maple
    A047994 := proc(n)
        local a, f;
        a := 1 ;
        for f in ifactors(n)[2] do
            a := a*(op(1,f)^op(2,f)-1) ;
        end do:
        a ;
    end proc:
    seq(A047994(n),n=1..20) ; # R. J. Mathar, Dec 22 2011
  • Mathematica
    uphi[n_] := (Times @@ (Table[ #[[1]]^ #[[2]] - 1, {1} ] & /@ FactorInteger[n]))[[1]]; Table[ uphi[n], {n, 2, 75}] (* Robert G. Wilson v, Sep 06 2004 *)
    uphi[n_] := If[n==1, 1, Product[{p, e} = pe; p^e-1, {pe, FactorInteger[n]}] ]; Array[uphi, 80] (* Jean-François Alcover, Nov 17 2018 *)
  • PARI
    A047994(n)=my(f=factor(n)~); prod(i=1, #f, f[1, i]^f[2, i]-1);
    
  • PARI
    for(n=1, 100, print1(direuler(p=2, n, (1 - 2*X + p*X^2)/(1-X)/(1-p*X))[n], ", ")) \\ Vaclav Kotesovec, Jun 15 2020
    
  • Python
    from math import prod
    from sympy import factorint
    def A047994(n): return prod(p**e-1 for p, e in factorint(n).items()) # Chai Wah Wu, Sep 24 2021

Formula

If n = Product p_i^e_i, uphi(n) = Product (p_i^e_i - 1).
a(n) = A000010(n)*A000203(A003557(n))/A003557(n). - Velin Yanev and Charles R Greathouse IV, Aug 23 2017
From Amiram Eldar, May 29 2020: (Start)
a(n) = Sum_{d|n, gcd(d, n/d) = 1} (-1)^omega(d) * n/d.
Sum_{d|n, gcd(d, n/d) = 1} a(d) = n.
a(n) >= phi(n) = A000010(n), with equality if and only if n is squarefree (A005117). (End)
Sum_{k=1..n} a(k) ~ c * Pi^2 * n^2 / 12, where c = A065464 = Product_{primes p} (1 - 2/p^2 + 1/p^3). - Vaclav Kotesovec, Jun 15 2020
Dirichlet g.f.: zeta(s-1) * zeta(s) * Product_{p prime} (1 - 2/p^s + 1/p^(2*s-1)). - Amiram Eldar, May 22 2025

Extensions

More terms from Jud McCranie