# [seqfan] Re: Product of run lengths in binary representation of n

Andrew Weimholt andrew.weimholt at gmail.com
Thu Nov 5 09:03:23 CET 2009

```I submitted the sequences related to the product of run lengths in the
binary representation of n.
I hope Franklin will also submit his related sequences :-)

%I A167489
%S A167489 1,1,1,2,2,1,2,3,3,2,1,2,4,2,3,4,4,3,2,4,2,1,2,3,6,4,2,4,6,3,4,5,5,4,3,
%T A167489 6,4,2,4,6,3,2,1,2,4,2,3,4,8,6,4,8,4,2,4,6,9,6,3,6,8,4,5,6,6,5,4,8,6,3,
%U A167489 6,9,6,4,2,4,8,4,6,8,4,3,2,4,2,1,2,3,6,4,2,4,6,3,4,5,10,8,6,12,8,4,8
%N A167489 Product of run lengths in binary representation of n
%e A167489 a(99) = 12, because 99 in binary is written 1100011 giving
the run lengths 2,3,2, and 2x3x2 = 12.
%Y A167489 Cf. A167490 - smallest number with binary run length product = n
%Y A167489 Cf. A167491 - members of A167490 sorted in ascending order
%Y A167489
%K A167489 nonn
%O A167489 0,4
%A A167489 Andrew Weimholt (andrew(AT)weimholt.com), Nov 05 2009

%I A167490
%S A167490 0,3,7,12,31,24,127,48,56,96,2047,99,8191,384,224,195,131071,199,524287,
%T A167490 387,896,6144,8388607,391,992,24576,455,1539,536870911,775
%N A167490 a(n) = Smallest number with binary run length product = n
%C A167490 a(p) = 2^p - 1 for prime p
%e A167490 a(4) = 12, because 12 is the smallest number with a binary
run length product of 4.
%e A167490 12 decimal = 1100 binary. Run lengths in binary are 2,2, and 2x2 = 4.
%e A167490
%Y A167490 Cf. A167489 - Product of run length in binary representation of n
%Y A167490 Cf. A167491 - Numbers in this sequence sorted in ascending order
%Y A167490
%K A167490 nonn
%O A167490 1,2
%A A167490 Andrew Weimholt (andrew(AT)weimholt.com), Nov 05 2009

%I A167491
%S A167491 0,3,7,12,24,31,48,56,96,99,127,195,199,224,384,387,391,455,775,780,792,
%T A167491 896,992,1539,1548,1560,1592,1799,2047,3079,3096,3103,3120,3128,3640,
%U A167491 3968,6144,6156,6192,6200,6243,6343,7175,7199,8191,12312,12319,12384
%N A167491 Members of A167490 sorted in ascending order
%C A167491 a(n) is the smallest number with the product of its binary
run lengths = A167489(a(n))
%e A167491 12 is in the sequence because the product of the run
lengths in the binary representation of 12 is 4, and no number less
than 12 has a binary run length product of 4.
%Y A167491 Cf. A167489 - Product of run lengths in the binary
representation of n
%Y A167491 Cf. A167490 - Smallest number with binary run length product = n
%Y A167491
%K A167491 nonn
%O A167491 1,2
%A A167491 Andrew Weimholt (andrew(AT)weimholt.com), Nov 05 2009

Andrew

On Wed, Nov 4, 2009 at 5:43 AM,  <franktaw at netscape.net> wrote:
> Maximum product of run lengths in representation of n in any base:
>
> 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 4, 3, 3, 4, 4, 3, 2, 4, 2, 3, 2, 3, 6,
> 4, 3, 4, 6, 3, 4, 5, 5, 4, 3, 6, 4, 2, 4, 6, 4, 3, 3,
> 3, 4, 2, 3, 4, 8, 6, 4, 8, 4, 3, 4, 6, 9, 6, 3, 6, 8, 4, 5, 6, 6, 5, 4,
> 8, 6, 3, 6, 9, 6, 4, 2, 4, 8, 4, 6, 8, 4, 4, 3, 4, 3,
> 4, 3, 3, 6, 4, 4, 4, 6, 3, 4, 5, 10, 8, 6, 12, 8, 4, 8, 12, 6, 4, 3, 4,
> 8, 4, 6, 8, 12, 9, 6, 12, 6, 6, 6, 9, 12
>
> Values of n such that the maximum product of run lengths is greater
> than the binary product of run lengths:
>
> 5, 10, 13, 21, 26, 40, 41, 42, 43, 53, 81, 82, 84, 85, 86, 90, 106,
> 117, 125, 149, 162, 165, 168, 169, 170, 171,
> 174, 213, 234, 298, 324, 325, 328, 330, 336, 337, 338, 340, 341, 342,
> 343, 346, 349, 350, 351, 360, 362, 363,
> 365, 373, 377, 378, 426, 490, 594, 597, 650, 661, 672, 674, 677, 680,
> 681, 682, 683, 684, 685, 686, 687, 692,
> 693, 698, 701, 702, 714, 715, 724, 725, 726, 730, 733, 746, 765, 850,
> 853, 854, 874, 938, 980, 981
>
> Values of n such that the maximum product of run lengths is 1 or 2
> (probably finite):
>
> 1, 2, 3, 4, 5, 6, 9, 10, 11, 18, 20, 22, 37, 45, 74, 173, 181
>
> Trivially, the maximum is 1 only for 1 and 2: a run length product of 2
> is always obtained for b = n-1 when n>2.
>
> The binary product is 1 only for n in A000975.  Same for ternary is
> A031941, base 4 is A031942, base 5 is A031943.
>
> -----
> PARI:
>
> digits(n, b=10) = local(r); r=[];while(n>0,r=concat([n%b],r);n\=b);r
>
> prodrunlength(n,b=10)={
>  local(r,c,digs);
>  digs=digits(n,b);
>  r=c=1;
>  for(k=2,#digs,if(digs[k]==digs[k-1],c++,r*=c;c=1));
>  r*c}
>
> maxprodrunlength(n)={
>  local(m);m=if(n>2,2,0);
>  for(b=2,sqrtint(n)+1,m=max(m,prodrunlength(n,b)));
>  m}
>
> Franklin T. Adams-Watters
>

```