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.

A356473 Denominator of the average of gcd(i,n) for i = 1..n.

This page as a plain text file.
%I A356473 #50 Apr 28 2023 08:16:52
%S A356473 1,2,3,1,5,2,7,2,3,10,11,3,13,14,1,1,17,2,19,5,21,22,23,6,5,26,1,7,29,
%T A356473 2,31,2,11,34,35,3,37,38,39,2,41,14,43,11,5,46,47,1,7,10,17,13,53,2,
%U A356473 55,14,57,58,59,1,61,62,3,1,13,22,67,17,23,70,71,6,73,74,3,19,11,26,79,5,3,82,83,21,85,86,29
%N A356473 Denominator of the average of gcd(i,n) for i = 1..n.
%C A356473 From _Robert Israel_, Dec 29 2022: (Start)
%C A356473 If n is prime, a(n) = n.
%C A356473 If n is an odd prime, a(n^2) = n.
%C A356473 If p and q are distinct primes with p | 2*q-1, then a(p*q) = q, except in the case of 3*5, where both 3 | 2*5-1 and 5 | 2*3-1, and a(3*5) = 1.
%C A356473 For semiprimes p*q where p <> q, p does not divide 2*q-1 and q does not divide 2*p-1, a(p*q) = p*q. (End)
%H A356473 Robert Israel, <a href="/A356473/b356473.txt">Table of n, a(n) for n = 1..10000</a>
%F A356473 a(n) = denominator of A018804(n)/n.
%F A356473 a(n) divides n, so in particular a(n) <= n. - _Charles R Greathouse IV_, Sep 08 2022
%e A356473 For n = 3, the average of the gcd's is (gcd(1,3) + gcd(2,3) + gcd(3,3))/3 = (1 + 1 + 3)/3 = 5/3 which has denominator a(3)=3.
%p A356473 f:= proc(n) local i;  denom(add(igcd(i,n),i=1..n)/n) end proc:
%p A356473 map(f, [$1..100]); # _Robert Israel_, Dec 29 2022
%t A356473 Table[Denominator[Sum[GCD[I, j], {j, 1, I}]/I], {I, 100}]
%t A356473 f[p_, e_] := e*(p - 1)/p + 1; a[n_] := Denominator[Times @@ f @@@ FactorInteger[n]]; Array[a, 100] (* _Amiram Eldar_, Apr 28 2023 *)
%o A356473 (Haskell)
%o A356473 map denominator (map (\i -> sum (map (\j -> gcd i j) [1..i]) % i) [1..])
%o A356473 (PARI) a(n) = denominator(sum(i=1, n, gcd(i, n))/n); \\ _Michel Marcus_, Aug 08 2022
%o A356473 (PARI) a(n,f=factor(n))=n/gcd(prod(i=1, #f~, (f[i, 2]*(f[i, 1]-1)/f[i, 1] + 1)*f[i, 1]^f[i, 2]),n) \\ _Charles R Greathouse IV_, Sep 08 2022
%o A356473 (Python)
%o A356473 from math import gcd, prod
%o A356473 from sympy import factorint
%o A356473 def A356473(n): return (p:=prod(f:=factorint(n)))//gcd(p,prod((p-1)*e+p for p, e in f.items())) # _Chai Wah Wu_, Sep 08 2022
%Y A356473 Cf. A356472 (numerators), A018804.
%K A356473 easy,frac,nonn,look
%O A356473 1,2
%A A356473 _Matthias Kaak_, Aug 08 2022