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.
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
Offset: 0
Examples
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
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Programs
-
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}]
Comments