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!)
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
a(n) = A087117(n) + A038374(n).
a(A000225(n)) = n for n > 0.
EXAMPLE
n [binary n ] A087117(n) + A038374(n) = a(n)
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:
map(f, [$0..100]); # Robert Israel, Apr 06 2020
MATHEMATICA
Table[Sum[Max[Differences[Position[Flatten@{k, IntegerDigits[n, 2], k}, k]]], {k, 0, 1}]-2, {n, 0, 82}]
CROSSREFS
Sequence in context: A182745 A129843 A349043 * A050430 A277329 A071330
KEYWORD
nonn,base
AUTHOR
Joshua Oliver, Nov 27 2019
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 June 29 07:27 EDT 2024. Contains 373826 sequences. (Running on oeis4.)