%I #14 Jul 28 2023 04:05:43
%S 0,0,1,3,3,7,6,12,7,15,12,22,12,24,19,33,15,31,24,42,22,42,33,55,24,
%T 48,37,63,33,61,48,78,31,63,48,82,42,78,61,99,42,82,63,105,55,99,78,
%U 124,48,96,73,123,63,115,90,144,61,117,90,148,78,138,109,171,63,127,96,162,82
%N a(0)=0, then a(n)=a(n-1)+(n-1) if n is odd, a(n)=a(n/2)+n/2 otherwise.
%H Robert Israel, <a href="/A096273/b096273.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) mod 2 = A095190(n); a(2n) mod 2 = a(2n+1) mod 2 = A010060(n); a(3n) = 0 mod 3.
%F G.f. g(x) satisfies g(x) = (1+x)*g(x^2)+x^2*(3*x+1)/(x^2-1)^2. - _Robert Israel_, Jan 20 2021
%p f:= proc(n) option remember;
%p if n::odd then procname(n-1)+n-1 else procname(n/2)+n/2 fi
%p end proc:
%p f(0):= 0:
%p map(f, [$0..100]); # _Robert Israel_, Jan 20 2021
%t a[0] = 0; a[n_] := a[n] = If[OddQ[n], a[n - 1] + n - 1, a[n/2] + n/2]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 28 2023 *)
%o (PARI) a(n)=if(n<1,0,if(n%2,a(n-1)+n-1,a(n/2)+(n/2)))
%Y Cf. A010060, A095190.
%K nonn
%O 0,4
%A _Benoit Cloitre_, Jun 23 2004