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!)
A175930 Concatenation of run lengths in binary expansion of n, written in base 2, then converted to base 10. 5
1, 3, 2, 6, 7, 5, 3, 7, 13, 15, 14, 10, 11, 7, 4, 12, 15, 27, 26, 30, 31, 29, 15, 11, 21, 23, 22, 14, 15, 9, 5, 13, 25, 31, 30, 54, 55, 53, 27, 31, 61, 63, 62, 58, 59, 31, 28, 20, 23, 43, 42, 46, 47, 45, 23, 15, 29, 31, 30, 18, 19, 11, 6, 14, 27, 51, 50, 62, 63, 61, 31, 55, 109, 111 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
From Rémy Sigrist, Jul 02 2019: (Begin)
a(2^k-1) = k for any k > 0.
a(2^k) = A004755(k) for any k > 0.
(End)
EXAMPLE
6 = 110, two runs, lengths 2 and 1, so we write down 101 and convert it to base 10, getting 5. So a(6) = 5.
MATHEMATICA
f[n_] := FromDigits[Flatten[IntegerDigits[Length /@ Split[IntegerDigits[n, \ 2]], 2]], 2]
Array[f, NUMBER OF TERMS]
PROG
(PARI) a(n) = my (b=[]); while (n, my (x=valuation(n+(n%2), 2)); b = concat(binary(x), b); n \= 2^x); fromdigits(b, 2) \\ Rémy Sigrist, Jul 02 2019
(Python)
from itertools import groupby
def a(n):
c = "".join(bin(len(list(g)))[2:] for k, g in groupby(bin(n)[2:]))
return int(c, 2)
print([a(n) for n in range(1, 75)]) # Michael S. Branicky, Oct 02 2021
CROSSREFS
Sequence in context: A236341 A293835 A258145 * A369272 A265346 A204939
KEYWORD
base,easy,look,nonn
AUTHOR
Dylan Hamilton, Oct 23 2010
EXTENSIONS
Edited by N. J. A. Sloane, Oct 23 2010
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 April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)