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.

Showing 1-2 of 2 results.

A058026 Number of positive integers, k, where k <= n and gcd(k,n) = gcd(k+1,n) = 1.

Original entry on oeis.org

1, 0, 1, 0, 3, 0, 5, 0, 3, 0, 9, 0, 11, 0, 3, 0, 15, 0, 17, 0, 5, 0, 21, 0, 15, 0, 9, 0, 27, 0, 29, 0, 9, 0, 15, 0, 35, 0, 11, 0, 39, 0, 41, 0, 9, 0, 45, 0, 35, 0, 15, 0, 51, 0, 27, 0, 17, 0, 57, 0, 59, 0, 15, 0, 33, 0, 65, 0, 21, 0, 69, 0, 71, 0, 15, 0, 45, 0, 77, 0, 27, 0, 81, 0, 45, 0, 27, 0
Offset: 1

Views

Author

Leroy Quet, Nov 15 2000

Keywords

Comments

Called the Schemmel totient function in the Handbook of Number Theory II. - R. J. Mathar, Apr 15 2011
a(n) is also the number of units u in Z/nZ such that Phi(1,u) or Phi(2,u) is a unit, where Phi is the cyclotomic polynomial. - Jordan Lenchitz, Jul 12 2017
This is the function phi(n, 1) in Alder. - Michel Marcus, Nov 14 2017

Examples

			a(15) = 3 because 1 and 2, 7 and 8 and 13 and 14 are all relatively prime to 15.
a(15) = a(3*5) = a(3)*a(5) = 3^0*(3-2)*5^0*(5-2) = 3.
		

References

  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 3, p. 276.

Crossrefs

Cf. A000010 (phi(n,0)), A002472 (phi(n,2)).

Programs

  • Haskell
    a058026 n = product $ zipWith (\p e -> p ^ (e - 1) * (p - 2))
                                  (a027748_row n) (a124010_row n)
    -- Reinhard Zumkeller, May 10 2014
    
  • Maple
    A058026 := proc(n) local a; a := n ; for p in numtheory[factorset](n) do a := a*(1-2/p) ; end do: a ; end proc: # R. J. Mathar, Apr 15 2011
  • Mathematica
    a[n_] := DivisorSum[n, n/# MoebiusMu[#] DivisorSigma[0, #]&]; Array[a, 90] (* Jean-François Alcover, Dec 05 2015 *)
    f[p_, e_] := (p-2) * p^(e-1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, May 01 2020 *)
  • PARI
    a(n) = sumdiv(n, d, n/d*moebius(d)*numdiv(d)); \\ Michel Marcus, Apr 27 2014
    
  • PARI
    a(n) = n*prod(p=1, n, if (isprime(p) && !(n % p), (1-2/p), 1)); \\ Michel Marcus, Feb 02 2016
    
  • PARI
    a(n) = my(r=1,f=factor(n)); for(j=1, #f[,1], my(p=f[j,1],e=f[j,2]); r*=(p-2)*p^(e-1)); return(r); \\ Jianing Song, Nov 01 2022

Formula

Multiplicative with a(p^e) = p^(e-1)*(p-2). - Vladeta Jovovic, Dec 01 2001
a(n) = Sum_{d|n} n/d*mu(d)*tau(d). - Vladeta Jovovic, Apr 29 2002
a(n) = Sum_{d divides n} phi(n/d)*(-1)^omega(d). - Vladeta Jovovic, Sep 26 2002
A003557(n) | a(n). - R. J. Mathar, Mar 30 2011
a(n) = n*Product_{primes p|n} (1-2/p). Dirichlet g.f. zeta(s-1)*product_p (1-2*p^(-s)). - R. J. Mathar, Apr 15 2011
a(n) = phi(n) * Sum_{d|n} mu(d)/phi(d), where mu(k) is the Moebius function and phi(k) is the Euler totient function. - Daniel Suteu, Jun 23 2018
Sum_{k=1..n} a(k) ~ c * n^2 / 2, where c = A065474 = Product_{primes p} (1 - 2/p^2) = 0.32263409893924467057953169254823706657095... - Vaclav Kotesovec, Dec 18 2019, corrected May 22 2025 (typo found by Amiram Eldar)
a(n) = Sum_{k=1..n} (-1)^omega(gcd(n,k)). - Ilya Gutkovskiy, Feb 22 2020
a(n) = Sum_{d1|n} Sum_{d2|n} mu(d1*d2)*floor(n/(d1*d2)). - Ridouane Oudra, Dec 31 2022

A002472 Number of pairs x,y such that y-x=2, (x,n)=1, (y,n)=1 and 1 <= x <= n.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 5, 4, 3, 3, 9, 2, 11, 5, 3, 8, 15, 3, 17, 6, 5, 9, 21, 4, 15, 11, 9, 10, 27, 3, 29, 16, 9, 15, 15, 6, 35, 17, 11, 12, 39, 5, 41, 18, 9, 21, 45, 8, 35, 15, 15, 22, 51, 9, 27, 20, 17, 27, 57, 6, 59, 29, 15, 32, 33, 9, 65, 30, 21, 15, 69, 12, 71, 35, 15, 34, 45, 11, 77, 24, 27
Offset: 1

Views

Author

Keywords

Comments

This is the function phi(n, 2) defined in Alder. - Michel Marcus, Nov 14 2017

Examples

			For n = 4, the condition gcd(x,4) = gcd(x+2,4) = 1 is satisfied by exactly two positive integers x not exceeding n, namely, by x = 1 and x = 3. Therefore a(4) = 2.
		

References

  • V. A. Golubev, Sur certaines fonctions multiplicatives et le problème des jumeaux. Mathesis 67 (1958), 11-20.
  • V. A. Golubev, Nombres de Mersenne et caractères du nombre 2. Mathesis 67 (1958), 257-262.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000010 (phi(n,0)), A058026 (phi(n,1)), A065474.
Similar generalizations of Euler's totient for prime k-tuples: this sequence (k=2), A319534 (k=3), A319516 (k=4), A321029 (k=5), A321030 (k=6).

Programs

  • Haskell
    a002472 n = length [x | x <- [1..n], gcd n x == 1, gcd n (x + 2) == 1]
    -- Reinhard Zumkeller, Mar 23 2012
  • Maple
    with(numtheory): seq(add(mobius(d)*phi(2*n)/phi(2*d), d in divisors(n)), n=1..100); # Ridouane Oudra, Aug 20 2024
  • Mathematica
    a[n_] := If[ Head[ r=Reduce[ GCD[x, n] == 1 && GCD[x+2, n] == 1 && 1 <= x <= n, x, Integers]] === Or, Length[r], 1]; Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Nov 22 2011 *)
    (* Second program (5 times faster): *)
    a[n_] := Sum[Boole[GCD[n, x] == 1 && GCD[n, x+2] == 1], {x, 1, n}];
    Array[a, 81] (* Jean-François Alcover, Jun 19 2018, after Michel Marcus *)
    f[p_, e_] := If[p == 2, p^(e-1), (p-2)*p^(e-1)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Jan 22 2020 *)
  • PARI
    a(n)=my(k=valuation(n,2),f=factor(n>>k));prod(i=1,#f[,1],(f[i,1]-2)*f[i,1]^(f[i,2]-1))<Charles R Greathouse IV, Nov 22 2011
    
  • PARI
    a(n) = sum(x=1, n, (gcd(n,x) == 1) && (gcd(n, x+2) == 1)); \\ Michel Marcus, Nov 14 2017
    

Formula

Multiplicative with a(p^e) = p^(e-1) if p = 2; (p-2)*p^(e-1) if p > 2. - David W. Wilson, Aug 01 2001
a(n) = Sum_{k=1..n} [GCD(2*n-k,n) * GCD(k+2,n) = 1], where [ ] is the Iverson bracket. - Wesley Ivan Hurt, Sep 29 2021
Sum_{k=1..n} a(k) ~ c * n^2, where c = (3/4) * Product_{p prime} (1 - 2/p^2) = (3/4) * A065474 = 0.2419755742... . - Amiram Eldar, Oct 23 2022
From Ridouane Oudra, Aug 20 2024: (Start)
a(n) = phi(2*n) * Sum_{d|n} mu(d)/phi(2*d).
a(n) = - phi(n) * Sum_{d|n} mu(2*d)/phi(d).
a(n) = A160467(n)*A058026(A000265(n)).
a(2*n+1) = A070554(n).
a(2^m*(2*n+1)) = 2^(m-1)*A070554(n), with m>0. (End)

Extensions

More terms from David W. Wilson
Showing 1-2 of 2 results.