How can I reduce timing to solve this equation?

I am tring to solve equation $$\frac{2 \log (x y+2021)}{\log (2)}+4^{x+1}=2^{x y+2022}+\frac{2 \log (2 x+1)}{\log (2)},$$ where $$x$$, $$y$$ are integer numbers. I tried

Reduce[4^(x + 1) + 2 Log[2, x y + 2021] ==
2^(x y + 2022) + 2 Log[2, 2 x + 1], {x, y}, Integers]

My computer runs too long. How can I reduce timing to solve this equation?

• This is math, not Mathematica. I vote to close the question. Jul 14 '20 at 17:23
• @user64494 Yes, I solved it by hand. But, I want to solve it by Mathematica. Jul 15 '20 at 0:24

For me, neither Reduce or Solve seem to be able to provide any solutions. However, if we fix x to integer values, FindInstance is able to give us at least a solution. For the first couple of integers we get

{x -> 1, y -> -2018}
{x -> 2, y -> -1008}
{x -> 3, y -> -2014/3}
{x -> 4, y -> -503}
{x -> 5, y -> -402}
{x -> 6, y -> -1004/3}
{x -> 7, y -> -2006/7}

There is a pattern here, and one can check that the following is always solution to your equation

y[x_] := -2020/x + 2

This can be checked analytically

{4^(x + 1) + 2 Log[2, x y + 2021],
2^(x y + 2022) + 2 Log[2, 2 x + 1]} /. y -> y[x] // Simplify

(*
{4^(1 + x) + (2 Log[1 + 2 x])/Log,
4^(1 + x) + (2 Log[1 + 2 x])/Log}
*)

so this also holds for real values of x.

For y to be an integer, x needs to be a divisor of 2020, so we get the following set of integer solutions

{{x -> -2020, y -> 3}, {x -> -1010, y -> 4}, {x -> -505,
y -> 6}, {x -> -404, y -> 7}, {x -> -202, y -> 12}, {x -> -101,
y -> 22}, {x -> -20, y -> 103}, {x -> -10, y -> 204}, {x -> -5,
y -> 406}, {x -> -4, y -> 507}, {x -> -2, y -> 1012}, {x -> -1,
y -> 2022}, {x -> 1, y -> -2018}, {x -> 2, y -> -1008}, {x -> 4,
y -> -503}, {x -> 5, y -> -402}, {x -> 10, y -> -200}, {x -> 20,
y -> -99}, {x -> 101, y -> -18}, {x -> 202, y -> -8}, {x -> 404,
y -> -3}, {x -> 505, y -> -2}, {x -> 1010, y -> 0}, {x -> 2020,
y -> 1}}

However, there may be solutions outside of this set.

Edit

Your equation can be rewritten as $$\begin{equation} 2^{2x+1}-2^{xy+2021} = \log_2{\left(\frac{2x+1}{xy+2021}\right)} \end{equation}$$

The solution found above is just the condition for both sides to vanish, i.e.

$$\begin{equation} 2x+1=xy+2021, \end{equation}$$

which is a much nicer derivation.

• It should be noticed that 4^(x + 1)- 2^(x y + 2022) is a rational number assuming x and y integer. This implies a certain condition for the arguments of the logarithms. BTW, all the solutions found with Maple satisfy both 4^(x + 1)== 2^(x y + 2022) and 2 Log[2, x y + 2021] == 2 Log[2, 2 x + 1]. Jul 14 '20 at 14:02
• Up to traditional math, {x -> -20, y -> 103} is not a solution in view of FunctionDomain[4^(x + 1) + 2 Log[2, x y + 2021], {x, y}, Reals] which produces x y > -2021. The true solutions are found by Reduce[4^(x + 1) == 2^(x y + 2022) && Log[2, x y + 2021] == Log[2, 2 x + 1], {x, y}, Integers]. Jul 15 '20 at 4:06
• I don't understand your point. At {x -> -20, y -> 103} both sides of the original equation become complex, but we have equality nonetheless, so it is a valid integer solution. Jul 15 '20 at 11:39
• Hausdorff, up to traditional math, integer solutions have to belong to the domains of the functions which are defined by the LHS and RHS over the reals and Reduce[Log[2, x y + 2021] == Log[2, 2 x + 1], {x, y}, Integers] takes it into account. Don't hesitate to ask for further explanation in need. Jul 15 '20 at 18:01