Best approach or algorithm to solve equation with multiple variables?

372 Views Asked by At

I have an equation :

$A^6x_1 + A^5x_2 + A^4x_3 + A^3x_4 + A^2x_5 + A^1x_6 + x_7 = B$

What can be the best algorithm/approach I can use to crack this?

$A$ and $B$ are constants. $x_1,x_2...x_7$ are variables.
A is a prime number. Sorry for not stating this earlier variables can have values from 0 to 15. The algorithm should be efficient.

1

There are 1 best solutions below

0
On

Let $x_7$ be the remainder when $B$ is divided by $A$. Let $B_1 = (B-x_7)/A$.

Let $x_6$ be the remainder when $B_1$ is divided by $A$. Let $B_2 = (B_1-x_6)/A$.

Let $x_5$ be the remainder when $B_2$ is divided by $A$. Let $B_3 = (B_2-x_5)/A$.

...

Let $x_2$ be the remainder when $B_5$ is divided by $A$. Let $B_6 = (B_5-x_2)/A$.

Finally, let $x_1 = B_6/A$.

This is basically the algorithm to write an integer $B$ in base-$A$, except you stop after getting $7$ digits.