Even if you're completely unfamiliar with the totient function, just basic arithmetic already fully suffices -
We start with a high speed chunking operation :
999,999,999,999,999,999,999,999
Divisibility by 7 can be chunked in multiples of 6-digits, so let's do 12+12 first (and keep chunking at the same width N as long as the chunked sum is still more than N digits) :
999,999,999,999 999,999,999,998
+ 999,999,999,999 ——> + 1
----------------- -----------------
1,999,999,999,998 999,999,999,999
Then let's go to the 6-digits width level :
999,999 999,998
+ 999,999 ——> + 1
----------------- -----------------
1,999,998 999,999
And there's the quick realization that 6 repeating digits (of ANY digit) is automatically divisible by 7.
jot 9 111111 - 111111 | mawk '($++NF = $1 % 7)^_'
111111 0
222222 0
333333 0
444444 0
555555 0
666666 0
777777 0
888888 0
999999 0
Which you can verify with any one of these chains :
999,999 --> 19,999 --> 5,999 --> 399 --> 49 --> 0
or 399 := - 1 + 20^2
:= (20 - 1) * (20 + 1)
:= 19 * 21
999,999 --> (99)(99)(99)
--> 1 0 1 0 1 --> 10^4 + 10^2 + 1
--> 3^4 + 3^2 + 1
--> 9^2 + 9 + 1
--> 2^2 + 2 + 1
--> 4 + 2 + 1 --> 7 --> 0
999,999 --> 222,222 --> 5,222
--> 5,222 - 7^4 * 2 - 7^3 --> 77 --> 0
or
--> 5,222 - 70^2 - 7^3 --> -21 --> 0
But if you REALLY wanna do it the totient way, then
jot 6 0 | mawk '($++NF = 10^$1 % 7)^_'
0 1 1
1 3 10
2 2 100
3 6 1,000
4 4 10,000
5 5 100,000
Since every natural number (under the modulus) shows up exactly once in the 2nd column, then 6 repeating digits (or any digit) mod 7 is the same as
DGT * ( 1 + 2 + 3 + 4 + 5 + 6 ) mod 7
= DGT * ( 6 * 7 / 2 ) mod 7 <-- by sum of integers formula
Since 7 is already a multiplier on the left hand side, then of course it's divisible by 7.
Side note : The divisors of the original number acts like digit concat
(with every partial product and grouped-multiplicands being a base-10 palindrome, doubling the # of 1s each round) :
111 # 3 x 37
x 1,001 # 7 x 11 x 13
---------------------------------
111,111
x 1,000,001 # 101 x 9,901
---------------------------------
111,111,111,111
x 1,000,000,000,001 # 73 x 137 x 99,990,001
---------------------------------
111,111,111,111,111,111,111,111
x 9
---------------------------------
999,999,999,999,999,999,999,999
=================================