%I #26 Dec 12 2023 07:41:31
%S 0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,
%T 9,4,0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4,
%U 0,13,0,4,9,4,0,13,0,4,9,4,0,13,0,4,9,4
%N Sum of squares d^2 over the divisors d=2 and/or d=3 of n.
%C Period 6: repeat [0, 4, 9, 4, 0, 13]. - _Wesley Ivan Hurt_, Jul 05 2016
%H Vladimir Shevelev,<a href="http://arXiv.org/abs/0903.1743">A recursion for divisor function over divisors belonging to a prescribed finite sequence of positive integers and a solution of the Lahiri problem for divisor function sigma_x(n)</a>, arXiv:0903.1743 [math.NT], 2009.
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (-1,0,1,1).
%F a(n) = Sum_{d|n, d=2 and/or d=3} d^2.
%F a(n) = -a(n-1) + a(n-3) + a(n-4) for n>4.
%F G.f.: x*(4+13*x+13*x^2) / ( (1-x)*(1+x)*(1+x+x^2) ).
%F a(n+6) = a(n).
%F a(n) = A010675(n) + A021115(n). [_R. J. Mathar_, May 28 2010]
%F a(n) = 4 * (1 + floor(n/2) - ceiling(n/2)) + 9 * (1 + floor(n/3) - ceiling(n/3)). - _Wesley Ivan Hurt_, May 20 2013
%F a(n) = 5 + 2*cos(n*Pi) + 6*cos(2*n*Pi/3). - _Wesley Ivan Hurt_, Jul 05 2016
%e a(1)=0, a(2)=2^2=4 since 2|2, a(3)=3^2=9 since 3|3, a(4)=2^2=4 since 2|4.
%p seq(op([0, 4, 9, 4, 0, 13]), n=1..30); # _Wesley Ivan Hurt_, Jul 05 2016
%t PadRight[{}, 100, {0, 4, 9, 4, 0, 13}] (* _Wesley Ivan Hurt_, Jul 05 2016 *)
%o (PARI) a(n)=[13,0,4,9,4,0][n%6+1] \\ _Charles R Greathouse IV_, May 21 2013
%o (Magma) &cat [[0, 4, 9, 4, 0, 13]^^20]; // _Wesley Ivan Hurt_, Jul 05 2016
%Y Cf. A010675, A021115, A098002, A178142.
%K nonn,easy,less
%O 1,2
%A _Vladimir Shevelev_, May 21 2010
%E Replaced recurrence by a shorter one; added keyword:less - _R. J. Mathar_, May 28 2010