|
|
A330036
|
|
The length of the largest run of 0's in the binary expansion of n + the length of the largest run of 1's in the binary expansion of n.
|
|
8
|
|
|
1, 1, 2, 2, 3, 2, 3, 3, 4, 3, 2, 3, 4, 3, 4, 4, 5, 4, 3, 4, 3, 2, 3, 4, 5, 4, 3, 3, 5, 4, 5, 5, 6, 5, 4, 5, 3, 3, 4, 5, 4, 3, 2, 3, 4, 3, 4, 5, 6, 5, 4, 4, 4, 3, 3, 4, 6, 5, 4, 4, 6, 5, 6, 6, 7, 6, 5, 6, 4, 4, 5, 6, 4, 3, 3, 4, 4, 4, 5, 6, 5, 4, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
All numbers appear in this sequence. The number of 1's in the n-th Mersenne number (A000225) is n and the number of 0's in the n-th Mersenne number is 0. 0+n=n. See formula.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
0 [ 0 ] 1 + 0 = 1
1 [ 1 ] 0 + 1 = 1
2 [ 1 0 ] 1 + 1 = 2
3 [ 1 1 ] 0 + 2 = 2
4 [ 1 0 0 ] 2 + 1 = 3
5 [ 1 0 1 ] 1 + 1 = 2
6 [ 1 1 0 ] 1 + 2 = 3
7 [ 1 1 1 ] 0 + 3 = 3
8 [ 1 0 0 0 ] 3 + 1 = 4
9 [ 1 0 0 1 ] 2 + 1 = 3
10 [ 1 0 1 0 ] 1 + 1 = 2
11 [ 1 0 1 1 ] 1 + 2 = 3
12 [ 1 1 0 0 ] 2 + 2 = 4
13 [ 1 1 0 1 ] 1 + 2 = 3
14 [ 1 1 1 0 ] 1 + 3 = 4
15 [ 1 1 1 1 ] 0 + 4 = 4
|
|
MAPLE
|
f:= proc(n) local L;
L:= convert(n, base, 2);
max(map(nops, [ListTools:-Split(`=`, L, 1)]))+max(map(nops, [ListTools:-Split(`=`, L, 0)]))
end proc:
|
|
MATHEMATICA
|
Table[Sum[Max[Differences[Position[Flatten@{k, IntegerDigits[n, 2], k}, k]]], {k, 0, 1}]-2, {n, 0, 82}]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|