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.

Original entry on oeis.org

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, 44, 45, 45, 48, 48, 49, 49, 80, 80, 81, 81, 84, 84, 85, 85, 92, 92, 93, 93, 96, 96, 97, 97, 112, 112, 113, 113, 116, 116, 117, 117, 124, 124, 125, 125, 128
Offset: 0

Views

Author

Jack Preston (jpreston(AT)earthlink.net), Mar 20 2008

Keywords

Comments

A recursive sequence that seems to be related to the ruler function.
It seems that a(2n) = a(2n+1) = A080277(n). - Emeric Deutsch, Mar 31 2008
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
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
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

Crossrefs

Cf. A080277, A003415, A333979, A135481 (first differences).

Programs

  • Maple
    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
  • Mathematica
    a = {0}; Do[AppendTo[a, Floor[n/2] + 2*a[[Floor[n/2] + 1]]], {n, 1, 100}]; a (* Stefan Steinerberger, Mar 24 2008 *)
    Table[Sum[2^(k-1)*Floor[n*2^-k], {k, 1, Log[2, n]}], {n, 0, 100}] (* Federico Provvedi, Aug 17 2013 *)
  • PARI
    a(n) = fromdigits(Vec(Pol(binary(n))'),2); \\ Kevin Ryde, Apr 29 2021
    
  • Python
    def A136013(n): return sum(map(lambda x:(x[0]+1)*(1<Chai Wah Wu, Jul 06 2022

Formula

a(n) = A333979(n,2). - Pontus von Brömssen, Sep 06 2020

Extensions

More terms from Stefan Steinerberger and Emeric Deutsch, Mar 24 2008
Spelling corrected by Jason G. Wurtzel, Aug 30 2010