User:JohnvO1957/sandbox

= Divisibility by repunit (11, 111, 1111, etc.), and the birthday G8 number = This article proposes an alternative rule for the divisibility of arbitrary natural numbers by the factor 11. The proposal leads to a general equation that generates a rule for the divisibility of arbitrary natural numbers of order M: $$N_M\equiv [a_{M-1}a_{M-2}\cdots a_2a_1a_0]$$ by $$\underbrace{ [111 \cdots 111]}_{M}$$.

The result is applied to 8-digit numbers that correspond to all 44,925 birthdays (dd-mm-yyyy) between 01-01-1900 and 31-12-2022. To that end the birthday-specified G8 number is introduced and some special cases are discussed.

Divisibility by 11
One of the well-known rules for the divisibility of natural numbers by 11 is that when adding the odd-numbered digits (reading from left to right) and subtracting the even-numbered digits of the number, the total should add up to zero, or be divisible by 11. For example: 132 gives 1+2-3=0, and therefore is divisible by 11 (12x11). Similarly, 12573 gives 1+5+3-2-7=0, and it can be written as 1143 x 11.

Here we describe an alternative way to obtain divisibility by 11 from arbitrary numbers. The following rule holds for all integer numbers with absolute value |N| ≥ 10:

Any number NM, for which the number of digits M≥2, becomes divisible by 11 when adding (M even) or subtracting (M odd) its reversed copy.

The reversed copy of a natural number, NM,rev, is obtained by writing all its digits in reversed order (e.g., N4 = 1234 becomes N4,rev = 4321).

M=2
Every two-digit number N2 between 10 and 99 has the following property: if summed with its reversed copy, the result is divisible by 11.

For example, N2 = 41 gives 41+14 = 55.

It can be readily shown that this property indeed holds for all numbers with M=2, written as N2 = [a1a0], which represents in decimal notation N2 = a1·101+a0·100:

S2 = [a1a0] + [a0a1] = (a0+a1)·(101+100) = (a0+a1)·11    q.e.d.

In summary, the property reads: mod ([a1a0] + [a0a1], 11) = 0.

M>2
This property can be extended to arbitrarily large numbers of order M, written as NM = [aM-1aM-2 ········a2a1a0] = aM-1·10M-1+ aM-2·10M-2+......+ a2·102+ a1·101+a0·100

Then, the following holds:

for M even: SM+ = [aM-1aM-2 ········a2a1a0] + [a0a1a2 ········aM-2aM-1] is divisible by 11.

For example:  8,647,332,126 + 6,212,337,468 =   14,859,669,594 =  1,350,879,054 x 11

for M odd:  SM- = [aM-1aM-2 ········a2a1a0] - [a0a1a2 ········aM-2aM-1] is divisible by 11.

For example: 18,647,332,126 - 62,123,374,681 = -43,476,042,555 = -3,952,367,505 x 11

Both properties can be proven by induction.

Proof:
M even: set M=2n. Express the numbers in their decimal expansion, and group digits with the same decimal:

SM+ = NM+NM,rev = [a2n-1a2n-2 ········a2a1a0] + [a0a1a2 ········a2n-2a2n-1] = Σk (a2n-k + ak-1)·(102n-k + 10k-1)   for n=1,2,3,.... and 1≤k≤n

It has to be shown that KN = (102n-k + 10k-1) = 10k-1·(102(n-k)+1 + 1) is divisible by 11 for all n=1,2,3,.... and 1≤k≤n

One therefore only has to look at the requirement:  mod(102(n-k)+1 + 1,11) = mod(K,11) = 0.

Note that the requirement is alway true for any n when k = n: in that case, K = (10 + 1) = 1x11.

For k=n-1 one obtains: K = (102(n-n+1)+1 + 1) = 1001 = 91x11.

Then for k=n-2: K = (102(n-n+2)+1 +1) = 100001 = 9091x11, etc., down to k=1:

For k=1: K = (102n+1 +1) is divisible by 11 for all n≥2.

This statement directly follows from induction (and from the well-known odd-even digit rule: 1-1=0).

q.e.d.

M odd: set M=2n+1. Write the numbers in their decimal expansion, and group digits with the same decimal (ac is the central digit):

SM- = NM-NM,rev = [a2na2n-1 ····ac·····a2a1a0] - [a0a1a2 ····ac····a2n-1a2n] = Σk (a2n-k - ak-1)·(102n-k + 10k-1)   for n=1,2,3,.... and 1≤k≤n, see above.

q.e.d.

From the divisibility generator of 11, we now proceed to a rule that generates divisibility by 111 for N3 numbers.

Divisibility by 111 for N3 numbers (N ∈ 100 - 999)
To obtain divisibility by 111 for all N3 numbers, the following rule holds:

Any number N3 = [a2a1a0] becomes divisible by 102+101+1 = 111 when taking the sum of all unique permutations of its digits.

Note that this rule is an extension of the divisibility-by-11 rule for N2 numbers, which gave: S2 = [a1a0] + [a0a1].

Example: N3=467 gives S3 = 467+476+647+674+746+764 = 3774 (= 34 x 111)

Proof:
If all digits differ, the total sum of the six possible permutations gives:

S3 = [a2a1a0] + [a2a0a1] + [a1a2a0] + [a1a0a2] + [a0a1a2] + [a0a2a1] = 2·(a0+a1+a2)·111

If one of the digits repeats (say, a0=a1) the total sum of unique permutations gives:

S3 = [a2a1a1] + [a1a2a1] + [a1a1a2] = (2a1+a2)·111

If all digits are identical S3 = [a2a2a2] = a2·111

All three cases are indeed divisible by 111.

q.e.d.

From this result, it is straightforward to extend the rule to arbitrarily large numbers.

Divisibility of [111 ..... 111] by 11, 111, 1111, etc.
The following property holds for the divisibility of $$\underbrace{ [111 \cdots 111] }_{2M}$$ (an even number of ones) by 11:

$$\sum_{m=0}^{2M-1} 10^{m} = 11 \cdot \sum_{m=0}^{M-1} 10^{2m}$$

Examples: M = 1: 11 = 11 x 1    M = 2:  1,111 = 11 x 101     M = 3:   111,111 = 11 x 10,101    M = 4:  11,111,111 = 11 x 1,010,101 etc.

In the same way, it can be readily seen that for divisibility by 111 the following must hold for $$\underbrace{ [111 \cdots 111] }_{3M}$$ (number of digits divisible by 3):

$$\sum_{m=0}^{3M-1} 10^{m} = 111 \cdot \sum_{m=0}^{M-1} 10^{3m}$$

Examples: M = 1: 111 = 111 x 1    M = 2:  111,111 = 111 x 1001     M = 3:   111,111,111 = 111 x 1,001,001    M = 4:  111,111,111,111 = 111 x 1,001,001,001 etc.,

from which one can formulate for the general case (multiples of 1, 11,   111,   1,111,   11,111, etc.):

$$\sum_{m=0}^{K\cdot M-1} 10^{m} = \sum_{k=0}^{K-1} 10^{k}\cdot \sum_{m=0}^{M-1} 10^{K\cdot m} \mbox{for}M=1,2,3,\cdots \mbox{and}K=1,2,3,\cdots(\leq M)$$

Some examples:

M=2, K=2:  1,111 = 11 x 101

M=3, K=3: 111,111,111 = 111 x 1,001,001

M=6, K=4: 111,111,111,111,111,111,111,111 = 11,111 x 100,001,000,010,000,100,001

M=7, K=5: 11,111,111,111,111,111,111,111,111,111,111,111 = 111,111 x 1,000,001,000,001,000,001,000,001,000,001

etc.

We now proceed with the question how to make arbitrary natural numbers, written as NM, divisible by [111 ... 111] (M ones)

Divisibility of NM by [111 ...... 111]
''Any M-digit number NM = [aM-1aM-2 ...... a2 a1 a0] can be made divisible by $$\sum_{m=0}^{M-1}10^m = \underbrace{ [111 \cdots 111] }_{M}$$ after taking the sum of all its unique digit permutations.''

This sum is obtained from the following expression:

$$S_M=\frac{(M-1)!}{\prod_{s=1}^mn_s!}\cdot \Biggl(\sum_{k=0}^{M-1}a_k\biggr)\cdot \sum_{m=0}^{M-1}10^m ~\mbox{with}\sum_{s=1}^m n_s \leq M$$ the m digits as that repeat ns times in the number.

Here, the ratio on the left quantifies the total number of unique permutations.

If all digits are unique (which is possible for numbers with M≤10), the equation reduces to

$$S_M=(M-1)!\cdot \bigl(\sum_{k=0}^{M-1}a_k\bigr)\cdot\sum_{m=0}^{M-1} 10^m $$

Note that these equations also capture the N2 and N3 cases:

M=2 gives S2 = 1!·(a0+a1)·11 (both digits unique), and S2 = (1!/2!)·(a1+a1)·11 = a1·11 (identical digits).

M=3 yields 2!·(a0+a1+a2)·111 (unique), or (2!/2!)·(a1+a1+a2)·111 = (2a1+a2)·111 (one repetition), or (2!/3!)·(a2+a2+a2)·111 = a2·111.

Examples: for N6=563,892 (all six digits unique), one obtains S6 = 5!·33·111,111 = 439,999,560 and for N6 = 563,863 (2 repetitions for digits 6 and 3), this yields S6 = 5!/(2!2!)·30·111,111 = 99,999,900

The maximum SM(M)
For an arbitrary number NM, the maximum value of SM is obtained when (i) its digits are maximally different (leading to the largest number of permutations), and (ii) its digits are largest (giving the highest sum of its digits).

For example, for the maximum value of S6 the number N6 should contain the digits 9,8,7,6,5 and 4 (digit sum = 39). For any such number (there are 6! = 720 different ones), the sum of all 720 digit permutations yields S6 = 5!·39·111,111 = 519,999,480, which is the largest possible value of S6. For M>10 digit repetitions become unavoidable. Thus, for the largest possible SM the number of repetitions for all 10 digits (0, 1, 2, ...,9) is nrep = div(M,10), and then for the remaining mod(M,10) digits (starting at 9, and counting downwards) the number of repetitions is nrep = div(M,10)+1.

For example, the largest possible S34 is generated by adding all permutations in N34 containing 4 repetitions of {9,8,7,6} and 3 repetitions of {5,4,3,2,1,0}; e.g. N34 = 9,999,888,877,776,666,555,444,333,222,111,000

For this number (of which there are 5.61·1026 unique permutations), the total sum yields S34 = 33!/(4!43!6)·165·$$\textstyle \sum_{m=0}^{33} \displaystyle 10^m$$ ≈ 9.2559·1028 ·$$\textstyle \sum_{m=0}^{33} \displaystyle 10^m$$≈ 1.0284·1062.

Figures 1 and 2 show that SM(M) grows approximately exponentially fast with M (Fig. 1; calculated for M≤100). The growth-rate, $$dS_M/dM$$, however, is not constant (Fig. 2): at every transition where a new 9 is repeated (i.e., after M=m·10, with m=1,2,3,....) the growth rate jumps downward. Note that for large M the downward jumps become smaller, and $$dS_M/dM$$ ≈ 100.



Application to birthdays: M=8 and calculating the G8 number
One can calculate the S8 value for a date (e.g., a birthday, given by dd-mm-yyyy). For dates, however, the possible N8 numbers are subjected to some restrictions, since dd ≤ 31, mm ≤ 12, and if one only considers the possible birthdays of all people living (near) today, we may restrict the years to 1900 ≤ yyyy ≤ 2022. This restriction leaves 44,925 possible dates between 01-01-1900 and 31-12-2022, including leap-days.

Birthdays may consist of 8 unique digits, e.g. 26-03-1957, but it is more common that there will be digit repetitions, e.g. in 01-01-1900, and in 11-11-1958. Since for all birthdays the common factor is 11,111,111, we can normalise the S8 by this factor, and call it the G8 number (after R.J. Goderie):

$$G_8=\frac{7!}{\prod_{s=1}^mn_s!}\cdot \Biggl(\sum_{k=0}^{7}a_k\biggr)~\mbox{with}\sum_{s=1}^m n_s \leq 8$$ the m (≤ 4) digits as that repeat ns times.



The following can be noted:


 * the number of unique permutations, given by the left-hand factor, can only attain 19 different values, for 21 different possible repetition sequences. They are all listed in Table 1, and may be observed as the more or less isolated clusters in Fig. 3.

* Date with the largest number of digit repetitions (nrep=7), only to be beaten by 11-11-1111.
 * The total number of different G8 numbers in these 123 years (i.e., 44,925 dates) is only N(G8) = 273.
 * The birthday with the largest number of digit repetitions (nrep = 7) is 11-11-1911, leading to the smallest G8 number of all dates: G8,MIN = 16.
 * The largest G8 numbers are found for dates with 8 unique digits. There are 360 such dates (only 0.8% of the total data set), with digit sums between 30 and 38 (Fig. 3, red dots). This means that these 360 dates can only attain 9 different G8 values. Only 24 of these dates have the highest digit sum of 38, e.g., 28-07-1956, which has G8,MAX = 191,520, which is 11,970 times as large as the smallest G8. Note also that these 360 dates are clustered over a restricted time window within the 123 years: between 26-05-1934 (digit sum: 30, day 12,564) and 25-06-1987 (digit sum: 38, day 31,952).
 * Clearly, not every birthday yields a unique G8: for example, 13-12-1958, with G8 = 25,200 gives the same result as 31-12-1958, and 371 more dates, such as 24-03-1901, 30-04-1921, 11-08-1937, 27-11-1945, etc. (in this case, these dates have either a single triple repetition and a total digit sum of 30, like in 13-12-1958, or two double repetitions with a digit sum of 20, like in 30-04-1921). This also holds for the four dates with the lowest digit sum of 4: 01-01-2000, 10-01-2000, 01-10-2000 and 10-10-2000, which all yield G8 = 84.
 * For the entire period of 123 years (which covers all ages of the total world population), only 13 birthdays have a unique G8 number. Table 2 lists them all.
 * The frequency distribution of all G8 numbers is shown in Fig. 4. The 13 unique dates are seen at the bottom of the graph. Although distributed over the entire period of 123 years (Table 2), they all have relatively low G8 numbers.
 * The G8 number that occurs most frequently in these 123 years is G8 = 32,760. It is generated by 838 different birthdays that share the following properties: eiher the date contains two double repetitions and a digit sum of 26 (this occurs 806 times; some examples are 28-05-1901, 28-04-1902, 16-07-2019, 25-07-2019, etc.), or the date contains one triple repetition with a digit sum of 39 (this occurs only 32 times, like in 26-03-1999, and 25-04-1999).

** This date yields the highest possible digit sum (48) of all >1,000,000 dates between 01-01-0001 and the end of the 28th century (2899)!

All dates between 01-01-0001 and 31-12-2099
One can perform the same analysis on all dates since January 1 of the Year 1. Up until the last day of this century (31-12-2099) this yields 766,644 days in total. Interestingly, this vast expansion of the number of possible dates has some, albeit relatively small, influence on the numbers mentioned above. For example:


 * The total number of days containing only unique digits grows from 360 to N = 2520, but this is still only a tiny fraction of only 0.3%. The very first day for which this occurs is 27-06-1345 (digit sum: 28), and the very last day for which it occurs remains 25-06-1987 (digit sum: 38). These unique dates are confined to a relatively tight time window across the 21 centuries, covering only 12,564 days = 1.6%. Fig. 5 shows these dates on linear scale to highlight that these 2520 dates generate only 11 different G8 numbers (only 2 more than over the last 123 years).GBAllfig5.jpg
 * The total number of different possible G8 numbers increases slightly from 273 to (still only) N(G8) = 302, because one new permutation is added: 7!/8! = 0.125 (8 identical digits: 11-11-1111), in combination with a larger range of digit sums (the minimum is now 3, for 01-01-0001, and 10-10-1000, etc.).
 * There are only 5 dates with a unique G8 number! They are listed in Table 3. The other 12 unique birthdays of Table 2 are therefore confined to the 123 years for the current world population.


 * The most popular G8 number of all times is G8 = 8,400, which occurs 14,208 times. It consists mostly of dates with a single triple repetition and one double repetition (14,074 times), for which the digit sum is 20, starting in 29-12-0006, and ending at 10-10-2097, but also including dates like 26-10-1316. For 134 of these popular G8 dates the digit sum is 40, and it contains one triple repetition and two doubles, the first occurrence being 19-09-0669, and the last one is found at 27-12-1999.
 * In summary, two dates stick out in human history since the birth of Christ: 11-11-1111 and 29-09-1999. The former contains 8 repetitive digits and the absolute lowest possible G8=1, whereas the latter generate the highest possible digit sum.