[seqfan] Re: Product of run lengths in binary representation of n
franktaw at netscape.net
franktaw at netscape.net
Wed Nov 4 14:43:21 CET 2009
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
-----Original Message-----
From: Andrew Weimholt <andrew.weimholt at gmail.com>
Product of run lengths in binary representation of n (starting at n=0)
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, 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, 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, 12, 6, 4, 2, 4, 8, 4, 6, 8, 12, 9, 6, 12, 6, 3,
6, 9, 12, 8, 4, 8, 10, 5, 6, 7,
Smallest number with with run length product = n (starting at n=1)
0, 3, 7, 12, 31, 24, 127, 48, 56, 96, 2047, 99, 8191, 384, 224, 195,
131071, 199, 524287, 387, 896, 6144, 8388607, 391, 992, 24576, 455,
1539,
Andrew
_______________________________________________
Seqfan Mailing list - http://list.seqfan.eu/
More information about the SeqFan
mailing list