%I #40 Feb 16 2025 08:33:00
%S 0,1,1,3,1,5,3,7,1,7,5,13,3,13,7,15,1,9,7,19,5,23,13,29,3,19,13,33,7,
%T 29,15,31,1,11,9,25,7,33,19,43,5,33,23,59,13,55,29,61,3,25,19,51,13,
%U 59,33,73,7,43,29,73,15,61,31,63,1,13
%N a(0)=0, a(1)=1, and for n>=2, a(2*n) = a(n), a(2*n+1) = 2*a(n) + a(n+1).
%C Equals row 2 of the array in A178239, an infinite set of sequences of the form a(n) = a(2n), a(2n+1) = r*a(n) + a(n+1). - _Gary W. Adamson_, May 23 2010
%C Given an infinite lower triangular matrix M with (1, 1, 2, 0, 0, 0, ...) in every column, shifted down twice for columns k>1; lim_{n->infinity} M^n = A116528, the left-shifted vector considered as a sequence with offset 1. - _Gary W. Adamson_, May 05 2010
%H G. C. Greubel, <a href="/A116528/b116528.txt">Table of n, a(n) for n = 0..2500</a>
%H H. Harborth, <a href="http://dx.doi.org/10.1090/S0002-9939-1977-0429714-1">Number of Odd Binomial Coefficients</a>, Proc. Amer. Math. Soc. 62, 19-22, 1977.
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Stolarsky-HarborthConstant.html">Stolarsky-Harborth Constant</a>
%F G.f.: x * Product_{k>=0} (1 + x^(2^k) + 2*x^(2^(k+1))). - _Ilya Gutkovskiy_, Jul 07 2019
%p A116528 := proc(n)
%p option remember;
%p if n <= 1 then
%p n;
%p elif type(n,'even') then
%p procname(n/2) ;
%p else
%p 2* procname((n-1)/2)+procname((n+1)/2) ;
%p end if;
%p end proc:
%p seq(A116528(n),n=0..70) ; # _R. J. Mathar_, Nov 16 2011
%t b[0]:= 0; b[1]:= 1; b[n_?EvenQ]:= b[n] = b[n/2]; b[n_?OddQ]:= b[n] = 2*b[(n-1)/2] + b[(n+1)/2]; a = Table[b[n], {n, 1, 70}]
%o (PARI) a(n) = if(n<2, n, if(n%2==0, a(n/2), 2*a((n-1)/2) + a((n+1)/2))); \\ _G. C. Greubel_, Jul 07 2019
%o (Magma)
%o a:=func< n | n lt 2 select n else ((n mod 2) eq 0) select Self(Round((n+1)/2)) else (2*Self(Round(n/2)) + Self(Round((n+2)/2))) >;
%o [a(n): n in [0..70]]; // _G. C. Greubel_, Jul 07 2019
%o (Sage)
%o def a(n):
%o if (n<2): return n
%o elif (mod(n,2)==0): return a(n/2)
%o else: return 2*a((n-1)/2) + a((n+1)/2)
%o [a(n) for n in (0..70)] # _G. C. Greubel_, Jul 07 2019
%Y Cf. A006046, A116529, A116552, A116553, A116554, A116555.
%K nonn,easy,changed
%O 0,4
%A _Roger L. Bagula_, Mar 15 2006
%E Edited by _G. C. Greubel_, Oct 30 2016