
Constructing Niven repunit – proofs
July 23, 2009
Revisiting the Saturday problem.
Given a number made only out of 1s, when is it exactly divisible by the number of 1s. How do we construct Niven Repunits?
This isn’t a tough problem, but my maths is rusty and I struggled to find a proof. I also wanted a proof that anyone with high school maths could follow.
In previous posts I put down some conjectures – it’s time to show some proofs. I’ve tried to make these as simple as possible.
Definitions
is a repunit (made of repeated 1s with n digits in number base b).
Algebraically they can be written as
A Niven repunit is divisible by the sum of its digits. As all the digits are “1” this is equivalent to saying it’s divisible by the number of digits.
ie. A Niven repunit satisfies:
A pretty obvious lemma
First we’re going to show if:
then:
Proof (although you probably don’t need it)
When
Using induction
Assume
We know:
So
Easy Niven repunits theorem
This first theorem lets us find our first Niven repunits really easily by just ensuring the number of digits is a factor of one less than the number base.
Theorem
Given a repunit with n digits in base b.
When n is a factor of b-1
The repunit will be exactly divisible by n
IE.
If n is chosen such that
Proof
Because:
We know:
One definition of a repunit is:
So using
and the lemma we arrive at.
Second set of Niven repunits
This second theorem allows us to create huge Niven repunits based on the first and second type of repunit. e.g. Why repunits with 2,997 are Niven.
Theorem
Given a Niven repunit, a new Niven repunit can created with a number of digits that is obtained by multiplying the number of a digits in the first repunit by any factor of the first repunit.
Choosing a value of p such that:
Then:
Proof
By definition of a repunit:
Multiplying top and bottom by
Rearranging
Moving the powers about
Note that by the definition of repunit:
and
So
We know our original repunit was divisible by n (because it was a Niven repunit).
ie.
If we can just prove that the other repunit is divisible by p we’ll be done.
It’s not enough to say the first repunit is divisible by p because p and n could be the same number – so just because the 111 is divisible 3 it doesn’t make 111 divisible by 9 – we need to prove the second p digit repunit in base b^n is also divisible by 3 (in that example).
i.e. if:
then
We can use a similar proof to the first theorem:
We know:
and we chose p to be a factor of this so
So:
So
any by definition
Remembering
Which is what we wanted to prove.
So in a nutshell
Because
and
Notes
Given these two theorems we can construct huge Niven repunits in any number base. It does seem a bit odd that if we start with a three digit repunit in base 10 we could end up multiplying it by a 37 digit repunit in base 1000!
But if you think about how base 1000 would be represent in decimal and how long multiplication works you’d see that it was:
111×1001001001001…1001
If you did the long multiplication you can see why you’d get another repunit and why it would be Niven.