OFFSET
1,4
COMMENTS
a(n) = 1 if and only if n is prime. - Robert Israel, Feb 04 2018
a(n) = n+1 if and only if n = 2*p with p an odd prime (A100484 \ {4}). - Bernard Schott, Jun 19 2023
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
From Richard L. Ollerton, May 06 2021: (Start)
a(n) = Sum_{k=1..n} A051953(gcd(n,k)).
Sum_{k=1..n} a(k) ~ (1/(2*zeta(2)))*(1 - 1/zeta(2)) * n^2 * (log(n) + 2*gamma - 1/2 - ((zeta(2)-2)/(zeta(2)-1))*(zeta'(2)/zeta(2))), where gamma is Euler's constant (A001620). - Amiram Eldar, Jan 11 2024
EXAMPLE
n = 24: divisors = {1, 2, 3, 4, 6, 8, 12, 24}, d-phi(d) = {0, 1, 1, 2, 4, 4, 8, 16}, phi(n/d) = {8, 4, 4, 2, 2, 2, 1, 1}, products = {0, 4, 4, 4, 8, 8, 8, 16}, a(24) = 52.
MAPLE
f:= n -> add(numtheory:-phi(d)*(n/d - numtheory:-phi(n/d)), d=numtheory:-divisors(n)):
map(f, [$1..100]); # Robert Israel, Feb 04 2018
MATHEMATICA
f1[p_, e_] := (e*(p - 1)/p + 1)*p^e; f2[p_, e_] := (e+1)*(p^e - p^(e-1)) - (e-1)*(p^(e-1) - p^(e-2)); a[n_] := Times @@ f1 @@@ (fct = FactorInteger[n]) - Times @@ f2 @@@ fct; a[1] = 0; Array[a, 100] (* Amiram Eldar, Apr 28 2023 *)
PROG
(PARI) a(n) = sumdiv(n, d, eulerphi(d)*(n/d - eulerphi(n/d))); \\ Michel Marcus, Feb 05 2018
CROSSREFS
KEYWORD
AUTHOR
Labos Elemer, Aug 14 2001
EXTENSIONS
Offset corrected by Robert Israel, Feb 04 2018
STATUS
approved