login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A162854 Take the binary representation of n. Reduce by half the number of digits in every run (completely of either 0's or 1's) of an even number of digits. Double the number of digits in every run of an odd number of digits in the binary representation of n (where the added digits have the same value that makes up the rest of the run's digits). a(n) = the decimal equivalent of the result. 1
3, 12, 1, 6, 51, 4, 63, 192, 27, 204, 25, 2, 19, 252, 3, 12, 771, 108, 13, 102, 819, 100, 831, 64, 11, 76, 9, 126, 1011, 12, 1023, 3072, 51, 3084, 385, 54, 435, 52, 447, 3264, 411, 3276, 409, 50, 403, 3324, 51, 4, 259, 44, 5, 38, 307, 36, 319, 4032, 507, 4044, 505 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Clarification: The consecutive "runs" (mentioned in the definition) alternate between those completely of 1's and those completely of 0's.
This sequence is not a permutation of the positive integers.
LINKS
EXAMPLE
152 in binary is: 10011000 There is a run of one 1, followed by a run of two 0's, followed by a run of two 1's, followed by a run of three 0's. We halve the two runs of two digits each to one digit each; and we double the number of digits (with a 1) in the first run of one 1, and double the number of digits (with 0's) in the last run of three 0's, to get 1101000000. a(152) is the decimal equivalent of this, which is 832.
MAPLE
rerun := proc(L) if nops(L) mod 2 = 0 then [op(1..nops(L)/2, L)] ; else [op(L), op(L)] ; fi; end: Lton := proc(L) local i; add( op(i, L)*2^(i-1), i=1..nops(L)) ; end: A162854 := proc(n) local strt, en, L, dgs, i; strt := 1; en := -1; L := [] ; dgs := convert(n, base, 2) ; for i from 2 to nops(dgs) do if op(i, dgs) <> op(i-1, dgs) then en := i-1 ; L := [op(L), op(rerun([op(strt..en, dgs)])) ] ; strt := i; fi; od: en := nops(dgs) ; L := [op(L), op(rerun([op(strt..en, dgs)])) ] ; Lton(L) ; end: seq(A162854(n), n=1..100) ; # R. J. Mathar, Aug 01 2009
MATHEMATICA
Table[FromDigits[Flatten[If[EvenQ[Length[#]], Take[#, Length[#]/2], Join[ #, #]]&/@ Split[IntegerDigits[n, 2]]], 2], {n, 60}] (* Harvey P. Dale, May 30 2018 *)
CROSSREFS
Sequence in context: A354568 A072117 A162853 * A342787 A110121 A321710
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Jul 14 2009
EXTENSIONS
Extended beyond a(16) by R. J. Mathar, Aug 01 2009
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 December 6 22:36 EST 2023. Contains 367616 sequences. (Running on oeis4.)