How to find $a$ & $b$ that satisfy $10^{n+1}=\sum_{i=1}^{n}{(a_{i}10^{i}-b_{i}9^{i})}$?

97 Views Asked by At

I have an equation of the form:

$$10^{n+1}=\sum_{i=1}^{n}{(a_{i}10^{i}-b_{i}9^{i})}$$

where $0 < a_{i} \leq 20$ and $0 < b_{i} \leq 18$.

By inspection, I can see that for $n=1$, $a=19$ and $b=10$ is a solution and I can verify in a spreadsheet that it is the only solution.

Is there an easy way to find the number of solutions (and what they are) for a given $n$, for example when $n=5$, or is this something that would have to be done by brute force with a computer (meaning checking all $(a,b)$ pairs to see if they are a solution)?

1

There are 1 best solutions below

2
On BEST ANSWER

Presumably your $a_i$ and $b_i$ are integers. Write your equation as

$$ \sum_{i=1}^n b_i 9^i = - 10^{n+1} + \sum_{i=1}^n a_i 10^i $$

Now $\sum_{i=1}^n b_i 9^i$ is a multiple of $9$, and can be any such multiple between $\sum_{i=1}^n 9^i = (9^{n+1}-9)/8$ and $\sum_{i=1}^n 18 \cdot 9^i = (9^{n+2}-9^2)/4$. Similarly, $-10^{n+1} + \sum_{i=1}^n a_i 10^i$ can be any multiple of $10$ between $(-8 \cdot 10^{n+1}-10)/9$ and $(11\cdot 10^{n+1}-200)/9$.

For $n=1$, the only multiple of $90$ between $9$ and $100$ is $90$, yielding your solution.

For $n=5$, there are $12547$ multiples of $90$ between $66429$ and $1195722$. For each such multiple $v$, you want to compute the number of $a$ such that $v = - 10^{6} + \sum_{i=1}^5 a_i \cdot 10^i $ and the number of $b$ such that $v = \sum_{i=1}^5 b_i \cdot 9^i$, multiply them, and add the results.