Imagine a number N which is made of digits d repeating n times
eg:
| Row Number | N | N mod 7 |
|---|---|---|
| 1 | 3 | 3 |
| 2 | 33 | 5 |
| 3 | 333 | 4 |
| 4 | 3333 | 1 |
| 5 | 33333 | 6 |
| 6 | 333333 | 0 |
| 7 | 3333333 | 3 |
| 8 | 33333333 | 5 |
| 9 | 333333333 | 4 |
| 10 | 3333333333 | 1 |
| 11 | 33333333333 | 6 |
From row 7 it keeps repeating
The reason i am asking this question due to this Problem
Is there any proof to this or is it just that I have to remember this.
It my first time encountering this pattern








$$$10^6 \equiv 1 \,\, \text{mod} \,7$$$ and $$$\frac{111111}{7} = 15873$$$.
$$$1111111 \equiv \,\, 1\cdot 10^6 + 111111 \equiv 1 + 111111\,\, \text{mod} \,7$$$
$$$11111111 \equiv \,\, 11 \cdot 10^6 + 111111 \equiv 11 + 111111\,\, \text{mod} \,7$$$
$$$11111111 \equiv \,\, 111 \cdot 10^6 + 111111 \equiv 111 + 111111\,\, \text{mod} \,7$$$
So we can spit number into blocks of $$$6$$$ and one block of $$$n \,\,\text{mod} \, 6$$$ ones (where $$$n$$$ number of digits), and all blocks of $$$6$$$ are divisible by $$$7$$$, so it repeats each $$$6$$$.
Note that, $$$\gcd(10, 7) = \gcd(9, 7) = 1$$$. Now, we have
By Fermet's Little Theorem we have,
Hence we'll get a repetition modulo 7.
could you please elaborate on how you managed to reduce
Here's what I've understood
Let the number
subtract one from both sides
We can stop here
as dividing on both sides with d/9 will only scale.How to proceed from here
let's say the number is $$$n$$$
then adding the next digit, the number would be $$$10n+d$$$
if $$$n \equiv k \space (mod \space p)$$$ then the next modulo would be $$$10k+d \space (mod \space p)$$$
one way to visualize this is with a graph with an directed edge between node $$$k$$$ and node $$$10k+d \space (mod \space p)$$$
if $$$p$$$ is coprime to $$$10$$$, then the following graph would have $$$p$$$ nodes, $$$p$$$ edges and will contain multiple components, each of them containing a cycle and some paths leading to a cycle (since there are no unique a,b that maps to the same node)
if there are:
$$$10a+d \equiv 10b+d \space (mod \space p)$$$
$$$10a \equiv 10b \space (mod \space p)$$$
since $$$p$$$ and $$$10$$$ are coprime:
$$$a \equiv b \space (mod \space p)$$$
if $$$p$$$ and $$$10$$$ aren't coprime then
$$$10k+d \equiv d \space (mod \space p)$$$ which means every edge will connect to d, which will make it a single cycle of size 1
this could also be extended to ANY base/digit and modulo
When you do long division, you will eventually get the same remainder twice, after which you repeat.
I think, I have an intuitive way of understanding "mod repeating things" in general. Any number n mod p will be always repeating because there is maximum (p-1) of different possible values of mod.
For example, let's think there is an imaginary case where d mod p = 1 , (dd) mod p = 2,...( (p-1)d) mod p = (p-1). Then finally it is confirmed that after p case it will always be between 0 to (d-1). If it is somewhere between it can go to some specific mod then it will start from that mod and repeating that cycle from that point. That's why there is always a repeating mod pattern.
Note: ((p-1)d) means basically (p-1) amount of d concatenated.
Sorry for my bad English.