|
|
A090079
|
|
In binary expansion of n: reduce contiguous blocks of 0's to 0 and contiguous blocks of 1's to 1.
|
|
10
|
|
|
0, 1, 2, 1, 2, 5, 2, 1, 2, 5, 10, 5, 2, 5, 2, 1, 2, 5, 10, 5, 10, 21, 10, 5, 2, 5, 10, 5, 2, 5, 2, 1, 2, 5, 10, 5, 10, 21, 10, 5, 10, 21, 42, 21, 10, 21, 10, 5, 2, 5, 10, 5, 10, 21, 10, 5, 2, 5, 10, 5, 2, 5, 2, 1, 2, 5, 10, 5, 10, 21, 10, 5, 10, 21, 42, 21, 10, 21, 10, 5, 10, 21, 42, 21
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
100 -> '1100100' -> [11][00][1][00] -> [1][0][1][0] -> '1010' ->
10=a(100).
|
|
MATHEMATICA
|
Table[FromDigits[#, 2] &@ Map[First, Split@ IntegerDigits[n, 2]], {n, 0, 83}] (* Michael De Vlieger, Dec 12 2016 *)
FromDigits[Split[IntegerDigits[#, 2]][[All, 1]], 2]&/@Range[0, 90] (* Harvey P. Dale, Oct 10 2017 *)
|
|
PROG
|
(Haskell)
a090079 = foldr (\b v -> 2 * v + b) 0 . map head . group . a030308_row
(Python)
from itertools import groupby
def a(n): return int("".join(k for k, g in groupby(bin(n)[2:])), 2)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|