OFFSET
2,1
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 2..125, including results from Bert Dobbelaere and from users l4m2, gsitcia, and anttiP in Code Golf challenge (terms 103..125)
Code Golf Stackexchange, Smallest and largest 100-bit square with maximum Hamming weight, fastest code challenge started Dec 15 2022.
EXAMPLE
See A357658.
PROG
(Python 3.10+)
from math import isqrt
def A357660(n):
c = 0
for k in range(isqrt((1<<n)-1)+1, isqrt((1<<n+1)-1)+1):
if (d:=(k**2).bit_count()) > c:
c, m = d, k
elif d == c:
m = max(m, k)
return m # Chai Wah Wu, Oct 14 2022
(C, x64asm, Rust, c++) see Code Golf link.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Hugo Pfoertner, Oct 09 2022
STATUS
approved