%I #40 Jun 24 2024 04:12:19
%S 0,2,5,8,12,14,21,20,28,30,37,32,52,38,53,60,64,50,81,56,92,86,85,68,
%T 124,90,101,108,132,86,165,92,144,138,133,152,204,110,149,164,220,122,
%U 237,128,212,234,181,140,288,182,245,216,252,158,297,244
%N Antidiagonal sums of the gcd(.,.) array A109004.
%H Alois P. Heinz, <a href="/A209295/b209295.txt">Table of n, a(n) for n = 0..10000</a> (first 5000 terms from G. C. Greubel)
%F a(0) = 0; a(n) = A018804(n) + n for n > 0. [Amended by _Georg Fischer_, Jan 25 2020]
%F a(n) = Sum_{d|n} phi(d)*(n/d + 1) for n >= 1. - _Peter Luschny_, Aug 25 2019
%p a:= n-> add(igcd(j, n-j), j=0..n):
%p seq(a(n), n=0..70); # _Alois P. Heinz_, Aug 25 2019
%p # Alternative (computes [a(n), n=0..10000] about 25 times faster):
%p a := n -> add(numtheory:-phi(d)*(n/d + 1), d = numtheory:-divisors(n)):
%p seq(a(n), n = 0..57); # _Peter Luschny_, Aug 25 2019
%t Table[Sum[GCD[n-k,k], {k,0,n}], {n,0,50}] (* _G. C. Greubel_, Jan 04 2018 *)
%t f[p_, e_] := (e*(p - 1)/p + 1)*p^e; a[n_] := n + Times @@ f @@@ FactorInteger[n]; a[0] = 0; Array[a, 100, 0] (* _Amiram Eldar_, Apr 28 2023 *)
%o (PARI) a(n) = n + sum(k=1, n, gcd(n,k)); \\ _Michel Marcus_, Jan 05 2018
%o (Magma)
%o A209295:= func< n | n eq 0 select 0 else (&+[(n/d+1)*EulerPhi(d): d in Divisors(n)]) >;
%o [A209295(n): n in [0..40]]; // _G. C. Greubel_, Jun 24 2024
%o (SageMath)
%o def A209295(n): return sum((n/k+1)*euler_phi(k) for k in (1..n) if (k).divides(n))
%o [A209295(n) for n in range(41)] # _G. C. Greubel_, Jun 24 2024
%Y Cf. A006580, A018804, A109004.
%K nonn,easy
%O 0,2
%A _R. J. Mathar_, Jan 17 2013