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!)
A048678 Binary expansion of nonnegative integers expanded to "Zeckendorffian format" with rewrite rules 0->0, 1->01. 14
0, 1, 2, 5, 4, 9, 10, 21, 8, 17, 18, 37, 20, 41, 42, 85, 16, 33, 34, 69, 36, 73, 74, 149, 40, 81, 82, 165, 84, 169, 170, 341, 32, 65, 66, 133, 68, 137, 138, 277, 72, 145, 146, 293, 148, 297, 298, 597, 80, 161, 162, 325, 164, 329, 330, 661, 168, 337, 338, 677, 340 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
No two adjacent 1-bits. Permutation of A003714.
Replace 1 with 01 in binary. - Ralf Stephan, Oct 07 2003
LINKS
N. J. A. Sloane, Transforms
FORMULA
a(n) = rewrite_0to0_1to01(n) [ Each 0->1, 1->10 in binary expansion of n ].
a(0)=0; a(n) = (3-(-1)^n)*a(floor(n/2))+(1-(-1)^n)/2. - Benoit Cloitre, Aug 31 2003
a(0)=0, a(2n) = 2a(n), a(2n+1) = 4a(n) + 1. - Ralf Stephan, Oct 07 2003
EXAMPLE
11=1011 in binary, thus is rewritten as 100101 = 37 in decimal.
MAPLE
rewrite_0to0_1to01 := proc(n) option remember; if(n < 2) then RETURN(n); else RETURN(((2^(1+(n mod 2))) * rewrite_0to0_1to01(floor(n/2))) + (n mod 2)); fi; end;
MATHEMATICA
f[n_] := FromDigits[ Flatten[IntegerDigits[n, 2] /. {1 -> {0, 1}}], 2]; Table[f@n, {n, 0, 60}] (* Robert G. Wilson v, Dec 11 2009 *)
PROG
(PARI) a(n)=if(n<1, 0, (3-(-1)^n)*a(floor(n/2))+(1-(-1)^n)/2)
(PARI) a(n) = if(n == 0, 0, my(A = -2); sum(i = 0, logint(n, 2), A++; if(bittest(n, i), 1 << (A++)))) \\ Mikhail Kurkov, Mar 14 2024
(Haskell)
a048678 0 = 0
a048678 x = 2 * (b + 1) * a048678 x' + b
where (x', b) = divMod x 2
-- Reinhard Zumkeller, Mar 31 2015
(Python)
def a(n):
return 0 if n==0 else (3 - (-1)**n)*a(n//2) + (1 - (-1)**n)//2
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 30 2017
(Python)
def A048678(n): return int(bin(n)[2:].replace('1', '01'), 2) # Chai Wah Wu, Mar 18 2024
CROSSREFS
MASKTRANS transform of A053644.
Cf. A124108.
Sequence in context: A120119 A364035 A298011 * A271586 A278508 A296208
KEYWORD
nonn,easy
AUTHOR
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 May 15 22:47 EDT 2024. Contains 372549 sequences. (Running on oeis4.)