The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A362564 a(n) is the largest integer x such that n + 2^x is a square, or -1 if no such number exists. 1
3, 1, 0, 5, 2, -1, 1, 3, 4, -1, -1, 2, -1, 1, 0, 7, 9, -1, -1, 4, 2, -1, 1, 0, -1, -1, -1, 3, -1, -1, -1, 5, 8, 1, 0, 6, -1, -1, -1, -1, 7, -1, -1, -1, 2, -1, 1, 4, 5, -1, -1, -1, -1, -1, -1, 3, 6, -1, -1, 2, -1, 1, 0, 9, 10, -1, -1, 11, -1, -1, -1, -1, 3, -1, -1, -1, 2, -1, 1, 6, -1, -1, -1, 4, -1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(n) is the maximum integer solution x of the indefinite equation n + 2^x = r^2 where n is a constant and r is a positive integer, or -1 if there are no solutions.
See A247763 for the number of solutions and for further information, references and links about this problem.
If n == 0 (mod 4), we first try x = 0 or 1; when x >= 2, the result can be derived from the result for n/4 (see formula).
If n == 2 (mod 4), the only possible values of x is 1, as otherwise n + 2^x == 2 (mod 4), so nonsquare.
If n == 3 (mod 4), the only possible values of x are 0 and 1, as otherwise n + 2^x == 3 (mod 4), so nonsquare.
If n == 1 (mod 4), or n = 4*k + 1 (k >= 0): we suggest that r = 2*m + 1, 4*k + 1 + 2^x = (2*m + 1)^2, thus k + 2^(x - 2) = m*(m + 1); if k is odd, the only possible values of x is 2 because m*(m + 1) is even.
If n = k^2 (k >= 1), 2^x = (r + k)*(r - k), so 2k must be in the form 2^i - 2^j.
The problem can be solved via reduction to three Mordell curves: n + z^3 = y^2, n + 2z^3 = y^2 or equivalently 4n + (2z)^3 = (2y)^2, n + 4z^3 = y^2 or equivalently 16n + (4z)^3 = (4y)^2, where z := 2^floor(x/3). For a given n, each of these three curves is known to have only a finite number of integer points (y,z), proving that x cannot be unbounded. - Max Alekseyev, Apr 26 2023
LINKS
FORMULA
a(4*k + 2) = 1 if k + 1 is a square, or -1 otherwise.
a(4*k + 3) = 1 if 4*k + 5 is a square, or 0 is k + 1 is a square and 4*k + 5 is a nonsquare, or -1 otherwise.
a(4*k + 4) = a(k) + 2 if a(k) >= 0, or 0 if 4*k + 1 is a square and a(k) = -1, or -1 otherwise.
a(8*k + 5) = 2 if 8*k + 9 is a square, or -1 otherwise.
a((2^i - 2^j)^2) = i + j + 2 for i,j >= 0.
a(n) > -1 if A247763(n) > 0, or equivalently n is in A051204. - Thomas Scheuerle, May 02 2023
EXAMPLE
See COMMENTS section for further proof.
For n = 1, 1 + 2^3 = 9 = 3^2;
for n = 4, 4 + 2^5 = 36 = 6^2;
for n = 7, 7 + 2^1 = 9 = 3^2;
for n = 9, 9 + 2^4 = 25 = 5^2.
PROG
(Sage) def a362564(n): return max((3*v-2*k for k in range(3) for z, _, _ in EllipticCurve([0, 4^k*n]).integral_points() if z>=1<<k and z==1<<(v:=valuation(z, 2))), default=-1) # Max Alekseyev, Apr 26 2023
CROSSREFS
Sequence in context: A121440 A348016 A353092 * A324664 A011084 A347924
KEYWORD
sign
AUTHOR
Yifan Xie, Apr 24 2023
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 May 17 19:53 EDT 2024. Contains 372607 sequences. (Running on oeis4.)