Solving constraint modulo equation

85 Views Asked by At

Let’s say we are given following equation: $$ax = 2^n, a,x, n \in \mathbb{Z_+}$$ where $a$ is given. And we are interested to get the maximum x and minimum n, or actually generally any $x$ and $n$, which solve the above equation.

1) I tried to formulate it as a optimization problem:

$$ \min_n \max_x (ax-2^n= 0) $$ but actually I do not know how to solve a opt. problem as an integer arithmetic (because of $\mathbb{Z_+}$).

2) My next try was to solve it as an modulo equation (i should say i am not really an expert in this field): $$ ax \equiv 0 \ mod(2^n)$$ but also here I do not know how to go further.

So any help, link or suggestion is welcome.

1

There are 1 best solutions below

0
On BEST ANSWER

By unique factorization of positive integers, such $x$ and $n$ exist if and only if $a=2^q$ for some nonnegative integer $q$. Then $x=2^p$ for some nonnegative integer $p$ and $n=p+q$.

From this it is immediate that the minimum $n$ is then $n=q$, with $p=0$ and so $x=2^0=1$. It is also immediate that there is no maximum $x$.