login
a(n) = Sum_{i=1..n} (n-i+1)*phi(i).
4

%I #23 Dec 09 2022 05:58:08

%S 0,1,3,7,13,23,35,53,75,103,135,177,223,281,345,417,497,593,695,815,

%T 943,1083,1233,1405,1585,1785,1997,2227,2469,2739,3017,3325,3649,3993,

%U 4353,4737,5133,5565,6015,6489,6979,7509,8051,8635,9239,9867,10517,11213,11925

%N a(n) = Sum_{i=1..n} (n-i+1)*phi(i).

%H Alois P. Heinz, <a href="/A103116/b103116.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = A005598(n) - 1.

%F G.f.: (1/(1 - x)^2)*Sum_{k>=1} mu(k)*x^k/(1 - x^k)^2. - _Ilya Gutkovskiy_, Mar 16 2017

%p b:= proc(n) option remember; `if`(n<1, [0$2],

%p (p-> p+[numtheory[phi](n), p[1]])(b(n-1)))

%p end:

%p a:= n-> b(n+1)[2]:

%p seq(a(n), n=0..55); # _Alois P. Heinz_, Oct 07 2021

%t Accumulate@Accumulate@EulerPhi@Range[0,100] (* _Vladimir Joseph Stephan Orlovsky_, Apr 21 2011 *)

%o (Magma)

%o A103116:= func< n | n eq 0 select 0 else (&+[(n-j+1)*EulerPhi(j): j in [1..n]]) >;

%o [A103116(n): n in [0..60]]; // _G. C. Greubel_, Dec 08 2022

%o (SageMath)

%o @CachedFunction

%o def A103116(n): return sum( (n-j+1)*euler_phi(j) for j in range(1, n+1) )

%o [A103116(n) for n in range(61)] # _G. C. Greubel_, Dec 08 2022

%Y Cf. A000010, A005598.

%K nonn

%O 0,3

%A _N. J. A. Sloane_, Apr 04 2007