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.

A176345 Sum of gcd(k,n) from k = 1 to n over "regular" integers only (an integer k is regular if there is an x such that k^2 x == k (mod n)).

This page as a plain text file.
%I A176345 #60 Jun 02 2025 02:50:48
%S A176345 1,3,5,6,9,15,13,12,15,27,21,30,25,39,45,24,33,45,37,54,65,63,45,60,
%T A176345 45,75,45,78,57,135,61,48,105,99,117,90,73,111,125,108,81,195,85,126,
%U A176345 135,135,93,120,91,135,165,150,105,135,189,156,185,171,117,270,121,183,195
%N A176345 Sum of gcd(k,n) from k = 1 to n over "regular" integers only (an integer k is regular if there is an x such that k^2 x == k (mod n)).
%C A176345 It is also the product of n and (2-1/p), taken over all primes p dividing n.
%H A176345 Daniel Suteu, <a href="/A176345/b176345.txt">Table of n, a(n) for n = 1..10000</a>
%H A176345 S. Chen and W. Zhai, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Zhai/zhai4.html">Reciprocals of the Gcd-Sum Functions</a>, J. Int. Seq. 14 (2011) # 11.8.3.
%H A176345 J.-M. De Koninck and I. Katai, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/DeKoninck/dekoninck7.html">Some remarks on a paper of L. Toth</a>, JIS 13 (2010) 10.1.2.
%H A176345 Vaclav Kotesovec, <a href="/A176345/a176345.jpg">Graph - the asymptotic ratio (1000000 terms)</a>
%H A176345 Laszlo Toth, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL12/Toth/toth3.html">A Gcd-Sum Function Over Regular Integers Modulo n</a>, Journal of Integer Sequences, Vol. 12 (2009), Article 09.2.5.
%H A176345 Laszlo Toth, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/Toth/toth10.html">A survey of gcd-sum functions</a>, J. Int. Seq. 13 (2010) # 10.8.1.
%H A176345 D. Zhang and W. Zhai, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/Zhang/zhang10.html">Mean Values of a Gcd-Sum Function Over Regular Integers Modulo n</a>, J. Int. Seq. 13 (2010), 10.4.7.
%H A176345 D. Zhang and W. Zhai, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Zhang/zhang14.html">Mean Values of a Class of Arithmetical Functions</a>, J. Int. Seq. 14 (2011) #11.6.5.
%F A176345 Multiplicative with a(p^e) = 2*p^e-p^(e-1).
%F A176345 Dirichlet g.f.: zeta(s-1)*product_p (1+p^(1-s)-p^(-s)). Dirichlet convolution of the series of absolute values of A097945 with A000027. - _R. J. Mathar_, Jun 11 2011
%F A176345 From _Daniel Suteu_, Jun 27 2018: (Start)
%F A176345 a(n) = Sum_{d|n} d * phi(n/d) * mu(n/d)^2.
%F A176345 a(n) = Sum_{d|n, gcd(n/d, d) = 1} d * phi(n/d). (End)
%F A176345 From _Richard L. Ollerton_, May 07 2021: (Start)
%F A176345 a(n) = Sum_{k=1..n} mu(n/gcd(n,k))^2*gcd(n,k).
%F A176345 a(n) = Sum_{k=1..n} mu(gcd(n,k))^2*n/gcd(n,k)*phi(gcd(n,k))/phi(n/gcd(n,k)). (End)
%F A176345 From _Vaclav Kotesovec_, Aug 20 2021: (Start)
%F A176345 Dirichlet g.f.: zeta(s-1)^2 * Product_{primes p} (1 + p^(1-2*s) - p^(2-2*s) - p^(-s)).
%F A176345 Let f(s) = Product_{primes p} (1 + p^(1-2*s) - p^(2-2*s) - p^(-s)), then Sum_{k=1..n} a(k) ~ n^2 * (f(2)*(log(n)/2 + gamma - 1/4) + f'(2)/2), where f(2) = Product_{primes p} (1 - 2/p^2 + 1/p^3) = A065464 = 0.428249505677094..., f'(2) = f(2) * Sum_{primes p} log(p) * (3*p - 2) / (p^3 - 2*p + 1) = 0.6293283828324697510445630056425352981207558777167836747744750359407300858... and gamma is the Euler-Mascheroni constant A001620. (End)
%F A176345 a(n) = Sum_{k = 1..n} rad(gcd(k, n)) = Sum_{d divides n} rad(d)*phi(n/d), where rad(n) = A007947(n). - _Peter Bala_, Jan 22 2024
%e A176345 For n = 8, the regular integers mod 8 are 1,3,5,7,8, so the sum of gcd's of 8 with these numbers is 12.
%p A176345 A176345 := proc(n)
%p A176345     n*mul(2-1/p,p=numtheory[factorset](n)) ;
%p A176345 end proc:
%p A176345 seq(A176345(n),n=1..40) ; # _R. J. Mathar_, Sep 13 2016
%t A176345 f[p_, e_] := 2*p^e - p^(e - 1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 11 2020 *)
%o A176345 (PARI) isregg(k, n) = {g = gcd(k, n); if ((n % g == 0) && (gcd(g, n/g) == 1), return(g), return(0));}
%o A176345 a(n) = sum(k=1, n, isregg(k, n)) \\ _Michel Marcus_, May 25 2013
%o A176345 (PARI) a(n) = sumdiv(n, d, d * eulerphi(n/d) * moebius(n/d)^2); \\ _Daniel Suteu_, Jun 27 2018
%o A176345 (PARI) a(n) = my(f=factor(n)); prod(k=1, #f~, 2*f[k,1]^f[k,2] - f[k,1]^(f[k,2]-1)); \\ _Daniel Suteu_, Jun 27 2018
%o A176345 (PARI) for(n=1, 100, print1(direuler(p=2, n, (1 + p*X^2 - p^2*X^2 - X)/(1-p*X)^2)[n], ", ")) \\ _Vaclav Kotesovec_, Aug 20 2021
%Y A176345 Cf. A007947, A143869.
%K A176345 nonn,mult,easy
%O A176345 1,2
%A A176345 _Jeffrey Shallit_, Apr 15 2010