Research Notes

Decimal endings on both faces of the grid

Yagel Bar · · Proved congruence classification

Question and answer

When do the two faces end in 09 and 11, and which other endings are possible? From row 4 onward, every cell has exactly one of four two-digit pairs: 09/11, 29/31, 69/71 or 89/91. The pair follows an exact exponent cycle of length 1, 2 or 4. Row 5 always gives 09/11; that pattern does not persist across all later rows. The first three rows have separate cycles or initial exceptions.

This is a congruence theorem for all positive orders and exponents, on both faces, regardless of primality. In particular, a decimal ending is not a primality test.

Definitions and the last digit

Let p=pk be the k-th prime, h=pk−1# with p0#=1, and M=hpn, for k,n≥1. Write N−=M−1=Yk(n) and N+=M+1=Yk+(n). An ending is a residue modulo 10d, padded on the left with zeros to d places when needed. Pairs below list minus first, plus second.

Last-digit theorem. For every k≥3 and n≥1, the endings are 9/1. The product M contains both 2 and 5: at k=3 they come from h=6 and p=5; at k≥4 both are already in h. Thus M≡0(mod10). For k=1, the last-digit pairs cycle as 1/3, 3/5, 7/9, 5/7; for k=2 they cycle as 5/7, 7/9, 3/5, 1/3, starting at n=1. These follow by multiplying successively by 2 or by 3 modulo 10.

Complete two-digit classification from row 4

For k≥4, set a≡h/10(mod10) and b≡p(mod10). The primorial is squarefree and includes 2 and 5 exactly once, so both a and b belong to {1,3,7,9}. Cancellation of a factor of 10 gives

M≡10r(mod100),r≡abn(mod10).

This proves the entire classification:

Residue rMinus endingPlus ending
10911
32931
76971
98991

The period is exactly the multiplicative order of b modulo 10: it is 1 for b=1, 2 for b=9, and 4 for b=3 or b=7. Indeed, equality after a shift T is equivalent to abn(bT−1)≡0(mod10). Since abn is a unit, this is equivalent to bT≡1(mod10). There is no initial transient.

In particular 09/11 occurs exactly when abn≡1(mod10). The following table solves that condition completely. A residue 0 modulo a period means its positive multiples, since n≥1 throughout.

ab = 1b = 3b = 7b = 9
1all nn = 0 mod 4n = 0 mod 4n even
3nevern = 3 mod 4n = 1 mod 4never
7nevern = 1 mod 4n = 3 mod 4never
9nevern = 2 mod 4n = 2 mod 4n odd

To check the table, list 3n(mod10) as 3, 9, 7, 1, and 7n as 7, 9, 3, 1; the powers of 9 alternate 9, 1. Multiplication by each a gives exactly the displayed solutions. Thus a row has 09/11 at every exponent if and only if a=b=1. These conditions depend on the row's primorial and base; there is no threshold in k beyond which every row has that ending. To prove the latter assertion, suppose there were only finitely many primes other than 2 and 5 whose residue modulo 10 is not 1, and let Q be their product. The integer 10Q−1 is odd, not divisible by 5 or by any prime in Q, and is 9 modulo 10. Yet a product of primes all 1 modulo 10 would be 1 modulo 10, a contradiction. Such bases therefore occur arbitrarily late, and every one has an exponent period greater than 1.

Examples and the exceptional rows

RowCenter MTwo-digit behavior
12^nPeriod 20 from n = 2; n = 1 is transient
22·3^nPeriod 20 from n = 1
36·5^n29/31 at n = 1; 49/51 for every n ≥ 2
430·7^n09/11, 69/71, 89/91, 29/31; repeat
5210·11^n09/11 for every n ≥ 1
62310·13^n29/31, 89/91, 69/71, 09/11; repeat
730030·17^n09/11 exactly when n = 1 mod 4
8510510·19^n89/91 for odd n; 09/11 for even n

For example, row 4 begins (209,211) and (1469,1471). Row 5 begins (2309,2311); row 6 begins (30029,30031), disproving a universal 09/11 rule for all k≥5. The row 3 assertion follows from 6⋅5=30 and 6⋅5n≡50(mod100) for n≥2: 52≡25(mod100) and multiplication by 5 leaves 25 unchanged.

For row 1, once n≥2 the center is 0 modulo 4; modulo 25 its powers of 2 have order 20. To verify that order, 210≡−1(mod25), 24≡16(mod25) and 220≡1(mod25) exclude every proper divisor of 20. The Chinese remainder theorem therefore gives exact period 20 modulo 100. The n=1 center has residue 2 modulo 4, so it never repeats later. For row 2, canceling the coefficient 2 reduces the period question to powers of 3 modulo 50. Their order is 20: 310≡−1(mod25), 34≡6(mod25), and 320≡1(mod25), while the modulo-2 condition is automatic. None of rows 1–3 ever has 09/11: rows 1 and 2 lack a factor 5 in M, and row 3 has precisely the two cases just proved.

Any number of decimal places

Period theorem. Fix d≥1 decimal places. If p is coprime to 10, put g=gcd(h,10d) and m=10d/g. Both faces have exact period ordm(p) from n=1, taking the order modulo 1 to be 1.

Proof. Equality of the center's residues at n+T and n is equivalent to 10d∣hpn(pT−1). Dividing by g leaves a coefficient (h/g)pn coprime to m, so the condition is precisely pT≡1(modm). Adding or subtracting 1 preserves this equality and its least positive period. For k≥4, g=10, so the exact period is ord10d−1(pk). For k=2, it is ord5⋅10d−1(3).

The two non-unit bases have a transient and must be treated separately:

RowFirst exponent of the periodic tailExact tail period
k = 1, p = 2n = dord modulo 5^d of 2
k = 3, p = 5n = dord modulo 2^max(d−1,0) of 5

Proof for the exceptions. At k=1, the residue modulo 2d is zero exactly when n≥d. The independent modulo-5d component is a unit cycle of powers of 2. At k=3, the residue modulo 5d is zero exactly when n≥d. Equality in the modulo-2d component, after canceling the factor gcd(6,2d)=2, is precisely 5T≡1(mod2d−1). For d=1 the modulus is 1 and the condition is automatic. The Chinese remainder theorem combines each stable zero component with its unit cycle to give the stated exact period. No periodic tail can start earlier: for n<d, the valuation at the base prime is n, and no later exponent has the same residue modulo that prime's d-th power. Subtracting or adding 1 again preserves equality. This proves both the start and the minimal period.

For example, row 3 has three-digit endings 029/031 at n=1, 149/151 at n=2, and 749/751 for every n≥3. The eventual fixed ending is a consequence of the theorem, not a guess from a short sample.

The proof applies to every cell, including composites and the value Y1(1)=1, which is neither prime nor composite. It supplies no prime counts or asymptotic prime-frequency claim. The patterns follow from the specified primorial construction and elementary congruences; no novelty claim is made for the multiplicative-order or Chinese-remainder principles.

This standalone Python example checks the displayed small rows by ordinary integer arithmetic, with no period-finding algorithm:

h = 1
for k, p in enumerate((2, 3, 5, 7, 11, 13, 17, 19), 1):
    pairs = [f"{(h*p**n-1)%100:02d}/{(h*p**n+1)%100:02d}"
             for n in range(1, 9)]
    print(k, pairs)
    h *= p

The repository's tools/test_trailing_digits.py additionally checks the classification and minimal periods against direct integer values on bounded grids. These computations check the statements' implementation; the proof above establishes the unbounded claims.

The paper's structural section explains the grid's sieve and factored neighbors. Exponent sieves addresses a different modular question: how divisors exclude exponent classes, and why their survival fractions need not multiply. To compute a complete integer, use Explore the Grid.