login
a(n) = Sum_{k=1..n, n mod k = 1} k^2.
4

%I #20 Sep 08 2022 08:45:00

%S 0,0,4,9,20,25,49,49,84,90,129,121,209,169,249,259,340,289,454,361,

%T 545,499,609,529,849,650,849,819,1049,841,1299,961,1364,1219,1449,

%U 1299,1910,1369,1809,1699,2209,1681,2499,1849,2561,2365,2649

%N a(n) = Sum_{k=1..n, n mod k = 1} k^2.

%H Robert Israel, <a href="/A053807/b053807.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = sigma_2(n-1) - 1 for n >= 2.

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

%p f:= n -> numtheory:-sigma[2](n-1) - 1: f(1):= 0:

%p map(f, [$1..100]); # _Robert Israel_, Jan 29 2018

%t a[1] = 0; a[n_] := DivisorSigma[2, n - 1] - 1;

%t Array[a, 50] (* _Jean-François Alcover_, Feb 28 2019 *)

%o (PARI) concat([0], vector(50, n, n++; sigma(n-1, 2) -1)) \\ _G. C. Greubel_, Feb 28 2019

%o (Magma) [0] cat [DivisorSigma(2, n-1) -1: n in [2..50]]; // _G. C. Greubel_, Feb 28 2019

%o (Sage) [0] + [sigma(n-1, 2) - 1 for n in (2..50)] # _G. C. Greubel_, Feb 28 2019

%Y Cf. A001157.

%K nonn,look

%O 1,3

%A _N. J. A. Sloane_, Apr 07 2000