cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A330036 #30 Apr 06 2020 12:31:37
%S A330036 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,
%T A330036 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,
%U A330036 4,4,5,6,4,3,3,4,4,4,5,6,5,4,3
%N 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.
%C A330036 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.
%H A330036 Robert Israel, <a href="/A330036/b330036.txt">Table of n, a(n) for n = 0..10000</a>
%F A330036 a(n) = A087117(n) + A038374(n).
%F A330036 a(A000225(n)) = n for n > 0.
%e A330036    n [binary n ]  A087117(n) + A038374(n) = a(n)
%e A330036    0 [       0 ]  1          + 0          = 1
%e A330036    1 [       1 ]  0          + 1          = 1
%e A330036    2 [     1 0 ]  1          + 1          = 2
%e A330036    3 [     1 1 ]  0          + 2          = 2
%e A330036    4 [   1 0 0 ]  2          + 1          = 3
%e A330036    5 [   1 0 1 ]  1          + 1          = 2
%e A330036    6 [   1 1 0 ]  1          + 2          = 3
%e A330036    7 [   1 1 1 ]  0          + 3          = 3
%e A330036    8 [ 1 0 0 0 ]  3          + 1          = 4
%e A330036    9 [ 1 0 0 1 ]  2          + 1          = 3
%e A330036   10 [ 1 0 1 0 ]  1          + 1          = 2
%e A330036   11 [ 1 0 1 1 ]  1          + 2          = 3
%e A330036   12 [ 1 1 0 0 ]  2          + 2          = 4
%e A330036   13 [ 1 1 0 1 ]  1          + 2          = 3
%e A330036   14 [ 1 1 1 0 ]  1          + 3          = 4
%e A330036   15 [ 1 1 1 1 ]  0          + 4          = 4
%p A330036 f:= proc(n) local L;
%p A330036   L:= convert(n,base,2);
%p A330036   max(map(nops,[ListTools:-Split(`=`,L,1)]))+max(map(nops,[ListTools:-Split(`=`,L,0)]))
%p A330036 end proc:
%p A330036 map(f, [$0..100]); # _Robert Israel_, Apr 06 2020
%t A330036 Table[Sum[Max[Differences[Position[Flatten@{k,IntegerDigits[n,2],k},k]]],{k,0,1}]-2,{n,0,82}]
%Y A330036 Cf. A000120, A000225, A007088, A023416, A038374, A087117.
%K A330036 nonn,base
%O A330036 0,3
%A A330036 _Joshua Oliver_, Nov 27 2019