login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A357742
a(n) is the maximum binary weight of the squares of n-bit numbers.
1
1, 2, 3, 5, 6, 8, 9, 13, 13, 15, 16, 18, 20, 22, 24, 25, 27, 29, 31, 34, 34, 37, 38, 39, 41, 44, 44, 47, 49, 51, 52, 54, 55, 57, 59, 63, 63, 64, 66, 68, 69, 72, 73, 76, 77, 78, 80, 82, 85, 87
OFFSET
1,2
FORMULA
a(n) = max(A357658(2*n-2), A357658(2*n-1)).
EXAMPLE
bit |
length | possible binary weight of k^2
of k | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
= n | the rightmost value is a(n)
-------+--------------------------------------------------------------
1 | 0 1
2 | 1 2 - -
3 | 1 2 3 - - -
4 | 1 2 3 4 5 - - -
5 | 1 2 3 4 5 6 - - - -
6 | 1 2 3 4 5 6 7 8 - - - -
7 | 1 2 3 4 5 6 7 8 9 - - - - -
8 | 1 2 3 4 5 6 7 8 9 10 11 - 13 - - -
9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 - - - - -
10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - - - - -
PROG
(Python 3.10+)
def A357742(n): return max((k**2).bit_count() for k in range(1<<n-1, 1<<n)) # Chai Wah Wu, Oct 17 2022
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
EXTENSIONS
a(47)-a(50) from Martin Ehrenstein, Dec 26 2023
STATUS
approved