login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A352631 Minimum number of zeros in a binary n-digit perfect square, or -1 if there are no such numbers. 1
0, -1, 2, 2, 2, 3, 2, 4, 3, 4, 3, 4, 4, 5, 2, 5, 4, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 6, 8, 8, 6, 7, 7, 8, 8, 9, 8, 9, 9, 8, 9, 10, 9, 9, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 10, 11, 11, 11, 9, 9, 11, 11, 11, 12, 11, 12, 11, 12 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Is there a formula that is easy to compute?
LINKS
EXAMPLE
a(6) = 3, because there are two 6-bit squares 36 = 100100_2 and 49 110001_2 with 4 and 3 zeros, respectively.
a(2) = -1, because the first two perfect squares 1 = 1_2 and 4 = 100_2 have 1 and 3 bits, respectively.
PROG
(Python)
from gmpy2 import is_square, popcount
for n in range(1, 33):
m=n+1
for k in range(2**(n-1), 2**n):
if is_square(k):
m=min(m, n-popcount(k))
print(n, -1 if m>n else m)
(Python 3.10+)
def A352631(n): return -1 if n == 2 else min(n-(k**2).bit_count() for k in range(1+isqrt(2**(n-1)-1), 1+isqrt(2**n))) # Chai Wah Wu, Mar 28 2022
CROSSREFS
Sequence in context: A278636 A126336 A364421 * A134446 A125749 A014085
KEYWORD
sign,base
AUTHOR
Martin Ehrenstein, Mar 25 2022
EXTENSIONS
a(43)-a(71) from Pontus von Brömssen, Mar 26 2022
a(72)-a(80) from Chai Wah Wu, Apr 01 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)