# Digit-sum division check in base-$n$

Several years ago now I realised that for any natural numbers $x$ and $y$ you could write $$x^y=(x-1) \left(\sum_{i=0}^{y-1}x^i\right)+1$$ This shows that $x^y-1$ will always be divisible by $x-1$, which after a bit of deliberation I realised meant that in any base a quick check for divisibility could be employed for divisors that are factors of the base number ${} - 1$ (hence $3$ and $9$ in base $10$) by adding the digits until only one digit was left and checking if that digit was divisible by the divisor.

I wrote the above formula and use in back of my maths book when I started high school (probably when I should have been listening to the teacher!) and completely forgot about it, until I was looking through my old book the other day and saw it. Now I'm wondering what the general version of this formula is (say for all integers), and what other uses it has beside division checks. If anyone could point me in the right direction I would be very grateful.

To be honest, I think there is a way to expand this for $x,y\in\mathbb{R}$.

Start by dividing,

$$\frac{x^y-1}{x-1}=?$$

Basically, we have some polynomial of the form $x^y-1$ set equal to $0$, and $x=1$ is one obvious root. The other roots can be found be dividing the said factors, and we result with

$$\frac{x^y-1}{x-1}=\Pi_{n=2}^{y}(x-r_n)$$

Where $r_n$ is the $n$th root. Interestingly, with Euler's formula, we can find a nice closed form solution for $r_n$,

$$r_n=e^{n\pi i}=\cos(n\pi)+i\sin(n\pi)$$

And looking a little bit further, I see you found the summation formula for a geometric series,

$$\sum_{n=0}^xa^n=\frac{a^{n+1}-1}{a-1}$$

We may derive this solution in numerous ways, one way being Perturbation methods, which I will not explain here, but an example is here. Just replace all of the $10$'s with $x$, and you derive your solution.

Lastly, I note that my formula for $\frac{x^y-1}{x-1}$ stops looking pretty when $y\in\mathbb{R}$, so I would stick to the summation formula.

• Thanks for the detailed answer! I just managed to derive the geometric formula you mentioned, so this doesn't really matter, but FYI the link is broken. Thanks again :) – acernine Apr 14 '16 at 8:21
• @acernine Aw, apparently the question has been deleted. But glad you derived it anyways, it is useful. – Simply Beautiful Art Apr 14 '16 at 20:07
• Thanks for your help, I'm not really sure what's going on here! First the up-votes of the question disappear one by one and then your answer disappears for me! It doesn't really matter anyway, because you've given me the answer I was looking for, so thanks again – acernine Apr 15 '16 at 6:51
• @acernine Uh, sure, no problem. As long as you got the answer, its all good. – Simply Beautiful Art Apr 15 '16 at 22:31