The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A266150 Take the binary representation of n, increase each run of 0's by one 0 if the length of run is odd, otherwise, if length of run is even, remove one 0. a(n) is the decimal equivalent of the result. 3
0, 1, 4, 3, 2, 9, 12, 7, 16, 5, 36, 19, 6, 25, 28, 15, 8, 33, 20, 11, 18, 73, 76, 39, 48, 13, 100, 51, 14, 57, 60, 31, 64, 17, 132, 67, 10, 41, 44, 23, 144, 37, 292, 147, 38, 153, 156, 79, 24, 97, 52, 27, 50, 201, 204, 103, 112, 29, 228, 115, 30, 121, 124, 63, 32 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
This is a self-inverse permutation of the positive integers.
LINKS
EXAMPLE
a(4) = 2 since 4 = 100 binary -> 10 = 2 decimal.
a(5) = 9 since 5 = 101 binary -> 1001 = 9 decimal.
a(6) = 12 since 6 = 110 binary -> 1100 = 12 decimal.
MATHEMATICA
Table[FromDigits[#, 2] &@ Flatten[If[First@ # == 0, If[OddQ@ Length@ #, Append[IntegerDigits@ #, 0], Most@ IntegerDigits@ #], #] & /@ Split@ IntegerDigits[n, 2]], {n, 64}] (* Michael De Vlieger, Dec 22 2015 *)
PROG
(PARI) a(n) = if (n==0, 0, my (b=n%2, r=valuation(n+b, 2), rr=if (b, r, r%2, r+1, r-1)); (a(n\2^r)+b)*2^rr-b) \\ Rémy Sigrist, Jan 20 2019
CROSSREFS
Sequence in context: A292828 A020703 A084483 * A276612 A058509 A105109
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Dec 21 2015
EXTENSIONS
a(0) = 0 prepended by Rémy Sigrist, Jan 20 2019
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 18 21:09 EDT 2024. Contains 373487 sequences. (Running on oeis4.)