Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A162853
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A162853 Take the binary representation of n. Reduce by one digit every run (completely of either 0's or 1's) of an even number of digits. Increase by one digit every run of an odd number of digits in the binary representation of n (where this added digit has the same value that makes up the rest of the run's digits). a(n) = the decimal equivalent of the result. +0
1
3, 12, 1, 6, 51, 4, 15, 48, 27, 204, 25, 2, 19, 60, 7, 24, 195, 108, 13, 102, 819, 100, 207, 16, 11, 76, 9, 30, 243, 28, 63, 192, 99, 780, 97, 54, 435, 52, 111, 816, 411, 3276, 409, 50, 403, 828, 103, 8, 67, 44, 5, 38, 307, 36, 79, 240, 123, 972, 121, 14, 115, 252, 31, 96 (list; graph; listen)
OFFSET

1,1

COMMENT

This is a self-inverse permutation of the positive integers.

Clarification: The consecutive "runs" (mentioned in the definition) alternate between those completely of 1's and those completely of 0's.

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 reduce the two runs of two digits each to one digit; and we add a digit (a 1) to the first run of one 1, and a digit (a 0) to the last run of three 0's, to get 11010000. So, a(152) is the decimal equivalent of this, which is 208.

MAPLE

rerun := proc(L) if nops(L) mod 2 = 0 then subsop(1=NULL, L) ; else [op(L), op(1, L)] ; fi; end: Lton := proc(L) local i; add( op(i, L)*2^(i-1), i=1..nops(L)) ; end: A162853 := 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(A162853(n), n=1..100) ; [From R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Aug 01 2009]

CROSSREFS

Sequence in context: A101710 A088799 A072117 this_sequence A162854 A110121 A069522

Adjacent sequences: A162850 A162851 A162852 this_sequence A162854 A162855 A162856

KEYWORD

base,nonn

AUTHOR

Leroy Quet (q1qq2qqq3qqqq(AT)yahoo.com), Jul 14 2009

EXTENSIONS

Extended beyond a(13) by R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Aug 01 2009

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified December 4 08:07 EST 2009. Contains 170310 sequences.


AT&T Labs Research