Problem 2043B - Digits
My Solution 313195895
Idea for divisibility by 7
The standard divisibility rule seems to require a recursive approach based on my reasoning which led me to using Fermat's Little Theorem instead.
We have:
which can be written as:
This simplifies to:
Note:
Hence,
can be written as:
Now, how does Fermat's Little Theorem come into play here?
According to Fermat's Little Theorem:
where $$$a \in \mathbb{Z}$$$, $$$p$$$ is prime and $$$\gcd(a, p) = 1$$$.
In this case, we want to check when the following holds:
For this to hold, we need $$$n!$$$ to be a multiple of $$$p - 1$$$ i.e 6.
Therefore $$$n!$$$ is a multiple of 6 when $$$n \gt 2$$$ as shown above.
Why n! must be a multiple of 6 for $$$ 7 \mid (10^{n!} - 1) $$$ to hold:
Assume $$$6 \mid n!$$$. Then we can write $$$n! = 6k$$$ where $$$k \in \mathbb{N}$$$
which holds from Fermat's Little Theorem.
Hence the condition necessary for
to be a multiple of 7 i.e
is
$$$7 \mid d $$$ (The trivial case) Or $$$n \gt 2$$$.
Do you have an alternative approach?







