login
a(n) is the maximum Hamming weight of the product x*y of two integers 2^(n-1) <= x <= y < 2^n.
4

%I #21 Apr 10 2026 11:05:37

%S 1,2,4,6,8,10,12,15,17,18,20,22,25,26,28,30,32,35,36,39,40,43,45,47,

%T 48,50,52,55,56,58,60,63,65,66,68,70,72,75,76,78,81,82,85,87,88,90,93,

%U 95,96,99,100,102,105,106,108,111,113,115,117,119,120,122,125

%N a(n) is the maximum Hamming weight of the product x*y of two integers 2^(n-1) <= x <= y < 2^n.

%H Chai Wah Wu, <a href="/A394988/b394988.txt">Table of n, a(n) for n = 1..95</a>

%e See A384987 and A394991.

%o (Python)

%o from sympy.utilities.iterables import multiset_permutations

%o from sympy import divisors

%o def A394988(n):

%o a = 1<<n-1

%o b = a<<1

%o k = (n<<1)-1

%o for l in range(k,0,-1):

%o for s in multiset_permutations('0'*(k+1-l)+'1'*l):

%o m = int(''.join(s),2)

%o for d in divisors(m):

%o if d**2>m:

%o break

%o if a<=d<b and a*d<=m<b*d:

%o return l # _Chai Wah Wu_, Apr 09 2026

%Y Cf. A000120, A053644, A394987, A394991.

%K nonn

%O 1,2

%A _Hugo Pfoertner_, Apr 09 2026

%E a(24)-a(63) from _Chai Wah Wu_, Apr 09 2026