This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A298011 #30 Jul 24 2023 02:35:38 %S A298011 0,1,2,5,4,9,10,17,8,17,18,29,20,33,34,49,16,33,34,53,36,57,58,81,40, %T A298011 65,66,93,68,97,98,129,32,65,66,101,68,105,106,145,72,113,114,157,116, %U A298011 161,162,209,80,129,130,181,132,185,186,241,136,193,194,253,196 %N A298011 If n = Sum_{i=1..h} 2^b_i with 0 <= b_1 < ... < b_h, then a(n) = Sum_{i=1..h} i * 2^b_i. %C A298011 This sequence is similar to A298043. %H A298011 Rémy Sigrist, <a href="/A298011/b298011.txt">Table of n, a(n) for n = 0..8192</a> %H A298011 Rémy Sigrist, <a href="/A298011/a298011.png">Colored scatterplot of a(n) for n = 0..2^16</a> (where the color is function of A000120(n)). %F A298011 a(n) = Sum_{k = 0..A000120(n)-1} A129760^k(n) for any n > 0 (where A129760^k denotes the k-th iterate of A129760). %F A298011 a(n) >= n with equality iff n = 0 or n = 2^k for some k >= 0. %F A298011 a(2 * n) = 2 * a(n). %F A298011 a(2^n - 1) = A000337(n). %F A298011 a(2 * n + 1) = a(2 * n) + 2 * n + 1. _David A. Corneth_, Jan 14 2018 %F A298011 G.f. g(x) satisfies g(x) = 2*(x+1)*g(x^2) + x*(1+x^2)/(1-x^2)^2. - _Robert Israel_, Jan 16 2018 %e A298011 For n = 42: %e A298011 - 42 = 2 + 8 + 32, %e A298011 - hence a(42) = 1*2 + 2*8 + 3*32 = 114. %p A298011 F[0]:= x -> x: %p A298011 for i from 1 to 8 do %p A298011 F[i]:= unapply(convert(series(2*(x+1)*F[i-1](x^2)+H, x, 2^(i+1)), %p A298011 polynom), x) %p A298011 od: %p A298011 seq(coeff(F[8](x),x,j),j=0..2^9-1); # _Robert Israel_, Jan 16 2018 %t A298011 a[0] = 0; a[n_] := a[n] = If[OddQ[n], a[n - 1] + n, 2*a[n/2]]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 24 2023 *) %o A298011 (PARI) a(n) = my (b=binary(n), z=0); forstep (i=#b, 1, -1, if (b[i], b[i] = z++)); return (fromdigits(b, 2)) %o A298011 (PARI) first(n) = n += (n-1)%2; my(res = vector(n)); res[1]= 1; for(i = 1, n\2, res[2 * i] = 2 * res[i]; res[2 * i + 1] = res[2 * i] + 2*i + 1); concat([0], res) \\ _David A. Corneth_, Jan 14 2018 %Y A298011 Cf. A000120, A000337, A129760, A298043. %K A298011 nonn,base,easy %O A298011 0,3 %A A298011 _Rémy Sigrist_, Jan 10 2018