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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A153733 Remove all trailing ones in binary representation of n. 5
0, 0, 2, 0, 4, 2, 6, 0, 8, 4, 10, 2, 12, 6, 14, 0, 16, 8, 18, 4, 20, 10, 22, 2, 24, 12, 26, 6, 28, 14, 30, 0, 32, 16, 34, 8, 36, 18, 38, 4, 40, 20, 42, 10, 44, 22, 46, 2, 48, 24, 50, 12, 52, 26, 54, 6, 56, 28, 58, 14, 60, 30, 62, 0, 64, 32, 66, 16, 68, 34, 70, 8, 72, 36, 74, 18, 76, 38 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

Harvey P. Dale, Table of n, a(n) for n = 0..1000

Index entries for sequences related to binary expansion of n

FORMULA

a(n) = n if n is even, a((n-1)/2) if odd.

a(n)/2 = A025480(n).

a(n) = A000265(n+1)-1. - M. F. Hasler, Mar 16 2018

MAPLE

f:= n -> (n+1)/2^padic:-ordp(n+1, 2)-1:

map(f, [$0..100]); # Robert Israel, Mar 18 2018

MATHEMATICA

Table[If[EvenQ[n], n, FromDigits[Flatten[Most[Split[IntegerDigits[n, 2]]]], 2]], {n, 0, 100}] (* Harvey P. Dale, Feb 15 2014 *)

PROG

(Haskell)

a153733 n = if b == 0 then n else a153733 n'  where (n', b) = divMod n 2

-- Reinhard Zumkeller, Jul 22 2014

From  M. F. Hasler, Mar 16 2018: (Start)

(PARI) A153733(n)=(n+=1)>>valuation(n, 2)-1 \\ most efficient variant: use this.

(PARI) {a(n)=while(bittest(n, 0), n>>=1); n} \\ for illustration: as long as there's a trailing bit 1, remove it.

(PARI) a(n)=for(i=0, n, bittest(n, i)||return(n>>i)) \\ scan the trailing 1's, then remove all of them at once. (End)

CROSSREFS

Cf. A000265, A007814, A007088.

Cf. A163575.

Sequence in context: A222303 A097945 A319997 * A083218 A203908 A139716

Adjacent sequences:  A153730 A153731 A153732 * A153734 A153735 A153736

KEYWORD

nonn,easy

AUTHOR

Reinhard Zumkeller, Dec 31 2008

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 14 12:36 EST 2018. Contains 317185 sequences. (Running on oeis4.)