cp's OEIS Frontend

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.

A136013 a(n) = floor(n/2) + 2*a(floor(n/2)), a(0) = 0.

This page as a plain text file.
%I A136013 #51 Aug 02 2022 12:43:23
%S A136013 0,0,1,1,4,4,5,5,12,12,13,13,16,16,17,17,32,32,33,33,36,36,37,37,44,
%T A136013 44,45,45,48,48,49,49,80,80,81,81,84,84,85,85,92,92,93,93,96,96,97,97,
%U A136013 112,112,113,113,116,116,117,117,124,124,125,125,128
%N A136013 a(n) = floor(n/2) + 2*a(floor(n/2)), a(0) = 0.
%C A136013 A recursive sequence that seems to be related to the ruler function.
%C A136013 It seems that a(2n) = a(2n+1) = A080277(n). - _Emeric Deutsch_, Mar 31 2008
%C A136013 It appears that if the binary expansion of n is n = Sum b_i*2^i (b_i=0 or 1), then a(n) = Sum i*b_i*2^(i-1). - _Marc LeBrun_, Sep 07 2015
%C A136013 The observations in the preceding two comments (by Emeric Deutsch and Marc LeBrun) follow from the formulas in A333979. - _Pontus von Brömssen_, Sep 06 2020
%C A136013 This sequence is a variant of the arithmetic derivative (A003415) based on powers of two instead of primes, because the relation  a(m*n) = m*a(n) + n*a(m) holds. If we define the polynomial P(2) = bit0*2^0 + bit1*2^1 + bit2*2^2 + ... = n, and P'(2) is the derivative of P(2), then we will observe P'(2) = a(n). - _Thomas Scheuerle_, Aug 02 2022
%F A136013 a(n) = A333979(n,2). - _Pontus von Brömssen_, Sep 06 2020
%p A136013 a:=proc(n) if n=0 then 0 else floor((1/2)*n)+2*a(floor((1/2)*n)) end if end proc: seq(a(n),n=0..60); # _Emeric Deutsch_, Mar 31 2008
%t A136013 a = {0}; Do[AppendTo[a, Floor[n/2] + 2*a[[Floor[n/2] + 1]]], {n, 1, 100}]; a (* _Stefan Steinerberger_, Mar 24 2008 *)
%t A136013 Table[Sum[2^(k-1)*Floor[n*2^-k], {k, 1, Log[2, n]}], {n, 0, 100}] (* _Federico Provvedi_, Aug 17 2013 *)
%o A136013 (PARI) a(n) = fromdigits(Vec(Pol(binary(n))'),2); \\ _Kevin Ryde_, Apr 29 2021
%o A136013 (Python)
%o A136013 def A136013(n): return sum(map(lambda x:(x[0]+1)*(1<<x[0]), filter(lambda x:x[1]=='1',enumerate(bin(n)[-2:1:-1])))) # _Chai Wah Wu_, Jul 06 2022
%Y A136013 Cf. A080277, A003415, A333979, A135481 (first differences).
%K A136013 nonn,easy
%O A136013 0,5
%A A136013 Jack Preston (jpreston(AT)earthlink.net), Mar 20 2008
%E A136013 More terms from _Stefan Steinerberger_ and _Emeric Deutsch_, Mar 24 2008
%E A136013 Spelling corrected by _Jason G. Wurtzel_, Aug 30 2010