login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A053645 Distance to largest power of 2 less than or equal to n; write n in binary and change the first digit to zero. 42
0, 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,6

COMMENTS

Cf. A083741.

a(A004760(n+1)) = n. - Reinhard Zumkeller, May 20 2009

Triangle read by rows in which row n lists the first 2^n nonnegative integers (A001477), n >= 0. Right border gives A000225. Row sums give A006516. See example. - Omar E. Pol, Oct 17 2013

REFERENCES

J.-P. Allouche and J. Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197 (see Ex. 24).

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

J.-P. Allouche and J. Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197.

Index entries for sequences related to binary expansion of n

FORMULA

a(n) = n-2^A000523(n).

G.f.: 1/(1-x) * ((2x-1)/(1-x) + sum_{k>=1} 2^(k-1)*x^2^k). - Ralf Stephan, Apr 18 2003

a(n) = (A006257(n)-1)/2. - N. J. A. Sloane, May 16 2003

a(1) = 0, a(2n) = 2a(n), a(2n+1) = 2a(n)+1. - N. J. A. Sloane, Sep 13 2003

a(n) = A062050(n) - 1. - N. J. A. Sloane, Jun 12 2004

a(n) = f(n-1,1) with f(n,m) = if n<m then n else f(n-m,2*m). - Reinhard Zumkeller, May 20 2009

EXAMPLE

From Omar E. Pol, Oct 17 2013: (Start)

Written as an irregular triangle the sequence begins:

0;

0,1;

0,1,2,3;

0,1,2,3,4,5,6,7;

0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15;

0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31;

(End)

PROG

(Haskell)

a053645 1 = 0

a053645 n = 2 * a053645 n' + b  where (n', b) = divMod n 2

-- Reinhard Zumkeller, Aug 28 2014

a053645_list = concatMap (0 `enumFromTo`) a000225_list

-- Reinhard Zumkeller, Feb 04 2013, Mar 23 2012

(PARI) a(n)=n-2^(#binary(n)-1) \\ Charles R Greathouse IV, Sep 02 2015

CROSSREFS

Cf. A053644, A002262, A160588, A000225, A030308.

Sequence in context: A242305 A049263 A014588 * A212598 A170899 A221321

Adjacent sequences:  A053642 A053643 A053644 * A053646 A053647 A053648

KEYWORD

nonn,easy,changed

AUTHOR

Henry Bottomley, Mar 22 2000

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified September 3 19:32 EDT 2015. Contains 261327 sequences.