Preprint
Article

This version is not peer-reviewed.

Carries, Rails and Resonance: The Structure of the Digit-Sum Parity Map

Submitted:

04 November 2026

Posted:

05 November 2026

You are already at the latest version

Abstract
Let s(n) be the sum of the decimal digits of n and let f(n) = n+ s(n) for odd n and f(n) = n−s(n) for even n. Our main result concerns the 2-cycles of f, which are most of itsobserved cycles. We prove that an odd a lies on a 2-cycle if and only if s(a) is odd and theaddition a+ s(a) produces exactly s(s(a))/9 carries, and we show that this required number iswithin 1/9 of the mean number of carries produced by adding s(a) to a random odd integer (a“carry balance” identity). Combining this with exchangeability of digits, an anti-concentrationlemma for carries and a local limit argument, we prove that the number of 2-cycles below Nis of exact order N/√log log N. In particular 2-cycles have density zero, so their number doesnot grow linearly in N, although numerically they make up most of the observed cycles. Wealso obtain an asymptotic formula for the 2-cycle density with error O((log D)2/√D) below10D. Combining it with an exact formula for the variance of the carry count and a sharp locallimit theorem, we prove an oscillation law: √log10 DT(D)/10D has no limit, its limit pointsform the interval [K0 726/301, K0√6] with K0 = 1/(12√11π), and the peak-to-trough ratiois √301/11 ≈1.577.Along the way we establish several exact structural facts: on multiples of nine, f is con-jugate to m → m±κ(m) with κ(m) = s(9m)/9 given by a digit formula; a general levelequation describes how the digit sum changes under each step; a conditional time-reversal iden-tity f(f(x) + 9) = x+ 9 holds whenever s(x) is even and s(f(x) + 9) = s(x); and the orbit of H·10L + x depends on H only through s(H) while it stays in one prefix block, which yieldsa cycle-counting algorithm with a rigorous error bound. We prove that an orbit is eventuallyperiodic if and only if its digit sums are bounded, and that every run of the orbit along whichthe digit sum stays constant moves it by at most O(k2), where 9k is that digit sum. Using thisand prefix lifting we give a computer-assisted proof that every orbit starting below 102224 iseventually periodic (and, for the binary analogue, every orbit starting below 23024). Whetherevery orbit is eventually periodic remains open. It would follow from a uniform quantitativestrengthening, a conjectured quadratic bound on climbs of auxiliary maps, for which we givenumerical evidence. Finally we treat every base b. In odd bases every orbit reaches 0. In every even base,including base 2 where the carry mechanism takes a different form, the structural results carryover and the 2-cycles again have density of exact order (log D)−1/2, with resonances at the base-b repunits bj−1.
Keywords: 
;  ;  ;  ;  ;  ;  

MSC:  11A63 (primary); 60J10; 60F05; 11K65

1. Introduction

Iterations built from the digits of an integer have a long history. The sequence n ↦ n + s ( n ) (“digit addition”, or “digital rivers”) and the associated self numbers go back to Kaprekar [17] and are catalogued in the OEIS [20,25]; the trajectories of this map always move upwards. Several parity-sensitive digit maps that can return have been recorded in the OEIS, mostly as lists of their periodic points; Table 1 compares them with ours.
The maps of A124176 and A124177 move by a signed digit sum that depends on the digit values, not on a global parity, so they have no analogue of our rails. In A243260 the branch is chosen by the parity of the digit sum. That agrees with our rule in odd bases, where n ≡ s b ( n ) ( mod 2 ) (Section 11), but not in base 10. Branching on the parity of the number itself produces the two rails of Section 4, and with them the carry characterisation of 2-cycles. We have not found structural or asymptotic results for any of these neighbouring maps; the OEIS entries list terms and give no proofs about densities or convergence. This is a targeted rather than an exhaustive search, so the novelty claim is for the results below, not for the idea of parity-dependent digit maps. The number of carries in random addition is a well-studied stochastic process: Holte found the remarkable transition matrix of the carries Markov chain [16], Diaconis and Fulman connected it with riffle shuffles and symmetric functions [15], Borodin, Diaconis and Fulman placed it among one-dependent determinantal processes [13], and Diaconis, Shao and Soundararajan studied carries from the viewpoint of group theory and additive combinatorics [14].
The distribution of the digit sum itself is classical. Central and local limit theorems for s q ( n ) are known, for example along polynomial sequences [4] and for digital expansions in linear recurrent bases [6], and its distribution along the primes was settled by Mauduit and Rivat [7]. Local limit theorems for additive functionals of non-homogeneous Markov chains are developed systematically by Dolgopyat and Sarig [5]. Their general results assume uniform ellipticity, which the carries chain lacks (a digit 0 or 9 of t forbids some transitions), so Section 10.1 proves the sharp local limit theorem we need directly.
What is known, then, is the carries chain, the limit theory of digit sums, and general local limit theory. What is new here is the dynamical application. We translate periodicity of a digit-sum map exactly into a carry-count event (Theorem 5) and pin that count to the mean (Theorem 9). We also give an exact variance formula for the carry count (Lemma 8) and an extremal bound for its digit averages (Lemma 9). Together these yield the density and oscillation theorems.
  • Earlier versions.
Two earlier, exploratory write-ups of this project, from June and September 2025, are archived with their sources in the accompanying repository [21], in the folder Digital Root/. The present paper supersedes them, and three of their statements need correction. First, the June write-up conjectured that every orbit reaches a multiple of 9 within five steps. This fails: n = 899457 needs 14 (Proposition 1). Second, the September write-up suggested that the number of distinct cycles grows roughly linearly with N. For 2-cycles, which are most of the cycles, the count is of order N / log log N (Theorem 10), so it grows only barely sublinearly. Third, its cycle counts could not be reproduced. For example, it reports 9 , 001 distinct cycles reached from the multiples of 9 up to 200 , 000 , where exact enumeration gives 4 , 149 (Table 8). Global convergence, stated there as a conjecture, remains open (Conjecture 21).
Maps that branch on the parity of n are a natural test bed for deterministic dynamics that behave “as if random”: the branching couples a local, arithmetic rule (here the propagation of carries) to a global dichotomy, and the resulting orbits are often hard to control. The 3 x + 1 map [19] is the best-known example; we mention it only as background, and do not suggest that the map studied here is comparably difficult. Indeed, the point of this paper is that for the map below the branching interacts with carries in a way that can be analysed exactly. We study
f ( n ) = n + s ( n ) , n odd , n − s ( n ) , n even , n ≥ 0 ,
the digit-sum parity map; the parity condition refers to the input n, not to its digit sum. We have not found earlier work on this particular map; its novelty lies less in the definition than in the connection it creates between a deterministic integer iteration and the probability theory of carries.
  • Why this map?
It is the simplest parity-branching map built from the digit sum: the two branches are the digit-addition map and its inverse direction. This choice makes it a minimal model in which a deterministic dynamical question can be translated exactly into a question about carries. Its 2-cycles are characterised by a carry count (Theorem 5), that count is pinned near its mean by a balance identity (Theorem 9), and the density of periodic points then becomes a local-limit problem for the carries chain (Theorem 10). We expect the same mechanism to govern other parity-branching digit maps, for instance in other bases or with weighted digit sums, and view the present map as a test case for it.
Numerically every orbit enters a short cycle after a few dozen steps at most, usually a 2-cycle such as 27 ↔ 36 . Figure 1 shows a typical longer cycle: a regular ascent followed by a regular descent that retraces it.
  • Main result.
Let T ( D ) be the number of odd integers below 10 D that lie on a 2-cycle.
Theorem 1 
(Theorems 5, 7 and 10). An odd a lies on a 2-cycle if and only if s ( a ) is odd and a + s ( a ) produces exactly s ( s ( a ) ) / 9 carries. There are absolute constants c , K > 0 such that, for all sufficiently large D,
c log D ≤ T ( D ) 10 D ≤ K log D .
The mechanism is simple to state. The number of carries required for a 2-cycle is essentially its own mean (Theorem 9); the carry count is a sum of about log D weakly dependent terms; and such a sum hits a value at its centre with probability of order ( log D ) − 1 / 2 .
  • Further results.
  • Self-similarity on multiples of nine and a digit formula for s ( 9 m ) (Theorem 2).
  • A general level equation describing how the digit sum changes under each step, and the resulting “rail” picture (Theorem 3).
  • A conditional time-reversal identity (Theorem 4); in the computed range, 43 , 194 of the 43 , 210 nonzero cycles have the “mountain” shape that it suggests. We do not prove a corresponding statement for all cycles.
  • Prefix lifting (Theorem 6): an exact count of cycles confined to one prefix block, and a count of all cycles below 10 D with an explicit error of at most 18 D · 10 D − L (Corollary 1).
  • Carry resonance: an asymptotic formula for T ( D ) / 10 D (Theorem 8); an exact formula for the variance of the carry count, 11 9 ∑ i q i ( 1 − q i ) (Lemma 8); a sharp local limit theorem for carries (Theorem 11); and the resulting oscillation law (Theorem 12): the normalised density log 10 D T ( D ) / 10 D has no limit, its limit points fill an explicit interval, and lim sup / lim inf = 301 / 11 (Corollary 4).
  • A convergence criterion: an orbit is eventually periodic if and only if its digit sums are bounded (Theorem 16); and every constant-level run moves an orbit by O ( k 2 ) (Theorem 17); and a computer-assisted proof that every orbit starting below 10 2224 (below 2 3024 in base 2) is eventually periodic (Theorems 18 and 19). Global eventual periodicity (Conjecture 21) remains open.
  • Other bases (Section 11): in odd bases every orbit reaches 0 (Theorem 13); in every even base the structure theorems hold (Theorem 14) and the 2-cycle density is of exact order ( log D ) − 1 / 2 (Theorem 15); in base 2 this requires a different switch mechanism (Lemma 11).
The main line of the paper is the density of 2-cycles and its oscillation (Section 8, Section 9 and Section 10). The structural results (Sections 3–7) supply the tools, and the other bases and convergence (Section 11 and Section 12) are further applications. Figure 2 shows how the main results depend on each other.

2. Preliminaries

Table 2 collects the notation used throughout.
All numbers are non-negative integers written in base 10, with digits n = ∑ i n i 10 i . For a , b ≥ 0 let C ( a , b ) be the number of carries in the schoolbook addition a + b (counting a final carry into a new leading digit), and for a ≥ b ≥ 0 let B ( a , b ) be the number of borrows in a − b .
Lemma 1 
(Carries and borrows). s ( a + b ) = s ( a ) + s ( b ) − 9 C ( a , b ) , and for a ≥ b , s ( a − b ) = s ( a ) − s ( b ) + 9 B ( a , b ) .
Proof. 
With incoming carries c i ∈ { 0 , 1 } , c 0 = 0 , column i produces the digit a i + b i + c i − 10 c i + 1 , and a final carry produces a leading digit equal to it. Summing, s ( a + b ) = s ( a ) + s ( b ) − 9 ∑ i c i + 1 = s ( a ) + s ( b ) − 9 C ( a , b ) . The second identity is the first applied to ( a − b ) + b = a , whose carries are the borrows of a − b .    □
This is the base-10 form of the identity behind Kummer’s theorem on carries [18]; the statistics of carries are studied in [15,16].
Lemma 2. 
s ( n ) ≡ n ( mod 9 ) ; hence 9 ∣ f ( n ) for even n, and 9 ∣ n implies 9 ∣ f ( n ) .
Proof. 
Since 10 ≡ 1 ( mod 9 ) , n = ∑ i n i 10 i ≡ ∑ i n i = s ( n ) ( mod 9 ) . For even n, f ( n ) = n − s ( n ) ≡ 0 ( mod 9 ) . If 9 ∣ n then 9 ∣ s ( n ) , so 9 ∣ n ± s ( n ) = f ( n ) .    □
Proposition 1 
(Reduction to multiples of nine). Every term after the first even term of an orbit is a multiple of 9. The first even term may come late: 11 → 13 → 17 → 25 → 32 → 27 needs five steps to reach a multiple of 9, and among n < 10 6 the maximum is 14 steps (at n = 899457 ).
Proof. 
If m is even then 9 ∣ f ( m ) by Lemma 2, and by the same lemma every later term is again a multiple of 9, by induction. The statements about 11 and about n < 10 6 are computational: they were obtained by iterating f from every starting value (see the Data and code section).    □
Remark 1. 
In particular, an orbit need not reach a multiple of nine within two steps, and an odd multiple of 9 need not map to an even number: if its digit sum is even it stays odd, and this is exactly what produces the ascending runs of Section 4.

3. Self-Similarity and a Digit Formula for s ( 9 m )

Theorem 2 
(Self-similarity). For m ≥ 0 let κ ( m ) = s ( 9 m ) / 9 . Then
κ ( m ) = B ( 10 m , m ) = # i ≥ 0 : m i > 9 · 0 . m i − 1 m i − 2 … m 0 ,
where 0 . m i − 1 … m 0 is the number in [ 0 , 1 ) formed by the digits below position i (empty for i = 0 ). Moreover 9 m ↦ f ( 9 m ) is conjugate to
g ( m ) = m + κ ( m ) , m odd , m − κ ( m ) , m even .
Proof. 
Since 9 m = 10 m − m and s ( 10 m ) = s ( m ) , Lemma 1 gives s ( 9 m ) = s ( 10 m ) − s ( m ) + 9 B ( 10 m , m ) = 9 B ( 10 m , m ) . In a subtraction a − b a borrow leaves column i exactly when a mod 10 i + 1 < b mod 10 i + 1 . With a = 10 m , a mod 10 i + 1 = 10 ( m mod 10 i ) , and the condition 10 ( m mod 10 i ) < m i 10 i + ( m mod 10 i ) is m i > 9 ( m mod 10 i ) / 10 i . Finally 9 m and m have the same parity, so f ( 9 m ) = 9 m ± s ( 9 m ) = 9 g ( m ) .    □
For instance κ ( 11 ) = 2 : m 0 = 1 > 0 and m 1 = 1 > 9 · 0.1 ; indeed s ( 99 ) = 18 . The theorem was checked against direct computation for all m < 10 6 .

4. Rails and the Level Equation

Definition 1. 
On multiples of 9 write s ( n ) = 9 k and call k thelevelof n. Theodd railconsists of the odd multiples of 9 and theeven railof the even ones.
Theorem 3 
(Level equation). Let 9 ∣ n with level k, i.e. s ( n ) = 9 k , and let κ ( k ) = s ( 9 k ) / 9 as in Theorem 2. Then
s ( n + 9 k ) = 9 k + κ ( k ) − C ( n , 9 k ) , s ( n − 9 k ) = 9 k − κ ( k ) + B ( n , 9 k ) ( n ≥ 9 k ) .
Thus an ascending step keeps the level if and only if it produces exactly κ ( k ) carries, and a descending step keeps the level if and only if it produces exactly κ ( k ) borrows. A step keeps the rail (the parity of n) if and only if k is even. In particular, for 1 ≤ k ≤ 10 one has κ ( k ) = 1 , so the level is kept exactly when there is one carry or one borrow.
Proof. 
By Lemma 1, s ( n ± 9 k ) = s ( n ) ± s ( 9 k ) ∓ 9 C (resp. ± 9 B ), and s ( 9 k ) = 9 κ ( k ) . The parity of n ± 9 k equals that of n iff 9 k is even, i.e. k is even. For 1 ≤ k ≤ 10 , 9 k ∈ { 9 , 18 , … , 90 } has digit sum 9.    □
The general form matters because a typical D-digit multiple of 9 has level k ≈ D / 2 , far beyond 10 when D is large; the equation was checked on 20 , 000 random multiples of 9 with up to 60 digits, 13 , 315 of them with k > 10 . Theorem 3 explains the regular motion seen in Figure 1: for small k, adding 9 k = 10 k − k typically lowers the units digit by k and raises the tens digit by k, leaving the digit sum and hence the step size unchanged. In general the orbit is a translation along its rail as long as each step produces exactly κ ( k ) carries or borrows; an exceptional step, with a different number, changes the level. Figure 3 summarises the resulting picture.

5. A Conditional Time-Reversal Identity and Mountain Cycles

Theorem 4 
(Conditional reversibility). Let x ≥ 0 . If s ( x ) is even and s ( f ( x ) + 9 ) = s ( x ) , then
f f ( x ) + 9 = x + 9 .
Equivalently, writing τ ( x ) = x + 9 , we have f ( τ ( f ( x ) ) ) = τ ( x ) at every such x. This is a conditional identity, not a global symmetry: it says nothing about points where either hypothesis fails.
Proof. 
Let S = s ( x ) , even. If x is odd, f ( x ) = x + S is odd and y = x + S + 9 is even, so f ( y ) = y − s ( y ) = x + S + 9 − S = x + 9 . If x is even, f ( x ) = x − S is even and y = x − S + 9 is odd, so f ( y ) = y + s ( y ) = x + 9 .    □
When the hypotheses hold along a whole stretch of an orbit, the stretch is retraced, shifted by 9, in the opposite direction. They hold on regular stretches: by Lemma 1, s ( f ( x ) + 9 ) = s ( f ( x ) ) + 9 − 9 C ( f ( x ) , 9 ) , which equals s ( f ( x ) ) exactly when adding 9 to f ( x ) produces one carry, while s ( f ( x ) ) = s ( x ) on a level-preserving step (Theorem 3). The identity was also checked directly for all 31 , 196 applicable x < 10 6 .
This suggests the mountain shape seen in Figure 1: an ascent on the odd rail, a turn, a descent on the even rail that is the τ -image of the ascent run backwards, and a second turn that closes the loop. We record its prevalence as a computational statement only.
Proposition 2 
(Computational census). Of the 43 , 210 distinct cycles other than the fixed point { 0 } reached from the starting values 1 ≤ n ≤ 2 · 10 6 (the fixed point 0, reached for instance by 1 → 2 → 0 , brings the total to 43 , 211 ), exactly 43 , 194 consist of one ascending run (odd terms) followed by one descending run (even terms); the other 16 have two ascending and two descending runs, the smallest being 799020 → 798993 → 799038 → 799002 → 798975 .
We do not know whether almost all cycles of f, in the sense of density, have the mountain shape; Theorem 4 gives a mechanism for it but not a proof. A 2-cycle is a mountain without regular stretches.

6. Two-Cycles

Proposition 3 
(Two-step identity). If n and s ( n ) are odd, then f ( n ) is even and f 2 ( n ) = n − s ( s ( n ) ) + 9 C ( n , s ( n ) ) .
Proof. 
By Lemma 1, s ( f ( n ) ) = s ( n ) + s ( s ( n ) ) − 9 C ( n , s ( n ) ) , and f 2 ( n ) = n + s ( n ) − s ( f ( n ) ) .    □
Theorem 5 
(Characterisation of 2-cycles). Every 2-cycle { a , b } , a ≠ b , contains exactly one odd number, and an odd a lies on a 2-cycle if and only if s ( a ) is odd and s ( s ( a ) ) = 9 C ( a , s ( a ) ) . Then 9 ∣ a ; and if a < 10 11 − 1 the condition reads: s ( a ) is odd and a + s ( a ) has exactly one carry.
Proof. 
Two even (or two odd) points would give b < a < b . For odd a, b = a + s ( a ) must be even (else f ( b ) > b > a ), so s ( a ) is odd, and f ( b ) = a is f 2 ( a ) = a , i.e. s ( s ( a ) ) = 9 C ( a , s ( a ) ) by Proposition 3. The converse is immediate. Since s ( s ( a ) ) ≡ a ( mod 9 ) , 9 ∣ a . For a < 10 11 − 1 , s ( a ) ≤ 98 , so s ( a ) ∈ { 9 , 27 , 45 , 63 , 81 } , each with digit sum 9.    □
Example 1. 
27 + 9 = 36 has one carry, so { 27 , 36 } is a 2-cycle. 999 + 27 = 1026 has three, so 999 is not on a 2-cycle: f ( 1026 ) = 1017 .
Let T ( D ) be the number of odd a < 10 D on a 2-cycle. By Theorem 5, T ( D ) is computed exactly by a digit-by-digit dynamic programme over (carry, digit sum so far, carries so far), summing over admissible t = s ( a ) ≡ 9 ( mod 18 ) ; it agrees with exhaustive enumeration for D ≤ 5 . Values are given in Table 3.

7. Prefix Lifting

Figure 4. Prefix lifting. Since s ( n ) = s ( H ) + s ( x ) and n has the parity of x, the orbit of H · 10 L + x depends on H only through σ = s ( H ) until the prefix changes.
Figure 4. Prefix lifting. Since s ( n ) = s ( H ) + s ( x ) and n has the parity of x, the orbit of H · 10 L + x depends on H only through σ = s ( H ) until the prefix changes.
Preprints 242433 g004
Theorem 6 
(Prefix lifting). Fix L ≥ 1 and for σ ≥ 0 let g σ ( x ) = x + σ + s ( x ) for odd x and x − σ − s ( x ) for even x. Let c L ( σ ) be the number of cycles of g σ contained in [ 0 , 10 L ) . Then for every prefix H the cycles of f all of whose terms have the form H · 10 L + x with 0 ≤ x < 10 L correspond bijectively to these cycles of g s ( H ) . Consequently the number of cycles of f below 10 D whose terms share a common prefix (above the last L digits) is
∑ σ ≥ 0 c L ( σ ) N ( D − L , σ ) , N ( d , σ ) = [ z σ ] 1 − z 10 1 − z d ,
where N ( d , σ ) counts d-digit strings (leading zeros allowed) with digit sum σ. The same holds for cycles of any fixed length.
Proof. 
For n = H · 10 L + x with 0 ≤ x < 10 L we have s ( n ) = s ( H ) + s ( x ) , and n ≡ x ( mod 2 ) . So as long as g s ( H ) ( x ) ∈ [ 0 , 10 L ) , f ( n ) = H · 10 L + g s ( H ) ( x ) . A cycle of f with constant prefix H is therefore a cycle of g s ( H ) inside [ 0 , 10 L ) , and conversely. Summing over prefixes H < 10 D − L grouped by s ( H ) gives the formula.    □
Theorem 6 counts only cycles confined to one prefix block. The remaining cycles cross a block boundary, and they are few.
Corollary 1 
(Counting all cycles, with error bound). Let Z ( D ) be the number of cycles of f all of whose terms are below 10 D (including the fixed point 0), and let Z L ( D ) = ∑ σ c L ( σ ) N ( D − L , σ ) . If 9 D < 10 L , then
Z L ( D ) ≤ Z ( D ) ≤ Z L ( D ) + 18 D · 10 D − L .
The same bound holds for cycles of any fixed length, in particular for 2-cycles.
Proof. 
Every cycle counted by Z L ( D ) is counted by Z ( D ) . A cycle not counted by Z L ( D ) has terms in at least two prefix blocks, so it contains a term n with f ( n ) in a different block. Since | f ( n ) − n | = s ( n ) ≤ 9 D < 10 L , the low part x = n mod 10 L then satisfies x ≥ 10 L − 9 D (if f ( n ) > n ) or x < 9 D (if f ( n ) < n ). At most 2 · 9 D · 10 D − L integers below 10 D have such a low part, and distinct cycles are disjoint.    □
  • Algorithm.
Compute c L ( σ ) for all needed σ (a functional graph on 10 L vertices per σ , with cycles found by pointer doubling), then evaluate the polynomial coefficients. This costs O ( 10 L · L · σ max + D σ max ) with σ max ≤ 9 D , instead of the 10 D orbits of brute force, and by Corollary 1 it determines Z ( D ) / 10 D to within 18 D / 10 L . Choosing L a little larger than log 10 D therefore makes the relative error as small as desired. For example, for D = 200 the guaranteed error in Z ( D ) / 10 D is 0.36 with L = 4 , 0.036 with L = 5 and 0.0036 with L = 6 . The profile costs about 10 L · L operations for each of the σ max ≈ 1 , 800 values of σ , i.e. about 10 9 operations for L = 5 ; in our implementation the L = 5 profile (for all σ ≤ 2 , 500 ) took under a minute on a laptop, and each extra digit of L multiplies the cost by about 10. In practice the agreement is much better than this bound: with L = 3 the formula reproduces the brute-force counts 2026 ( D = 5 ) and 21566 ( D = 6 ) exactly, and with L = 5 , restricted to 2-cycles, it reproduces the exact T ( D ) / 10 D to six decimal places for every 6 ≤ D ≤ 200 in Table 3 (where the bound 18 D / 10 L alone would only guarantee about two decimal places).
The profile c 2 ( σ ) (Figure 5) is irregular, and that is the source of every oscillation in the counts: the density of cycles below 10 D is the average of c L ( σ ) / 10 L against the digit-sum distribution of a random ( D − L ) -digit prefix, a bell curve centred at 4.5 ( D − L ) of width about 8.25 D , which slides across the irregularities as D grows.

8. Carry Resonance and the Density of 2-Cycles

For an odd multiple t of 9 let ρ ( t ) be the probability that adding t to a random integer with odd units digit produces exactly s ( t ) / 9 carries. With a uniformly random digit of a, a column whose digit of t is d and whose incoming carry is c produces a carry with probability ( d + c ) / 10 . Hence, marking carries by z,
ρ ( t ) = [ z s ( t ) / 9 ] u ⊤ M 1 ( t 0 ) M ( t 1 ) … M ( t ℓ − 1 ) M ( 0 ) ∞ 1 , M ( d ) = 1 10 10 − d d z 9 − d ( d + 1 ) z ,
with u = ( 1 , 0 ) ⊤ and M 1 the units column restricted to odd digits. This is the carries Markov chain [15,16].
Proposition 4. 
ρ ( 10 j − 1 ) = 9 / 10 for every j ≥ 1 .
Proof. 
Adding t = 10 j − 1 to a with odd units digit: the units column gives a 0 + 9 ≥ 10 , and each of the next j − 1 columns gives a i + 9 + 1 ≥ 10 , so all j columns carry and s ( t ) / 9 = j . Exactly j carries occur iff column j does not carry, i.e. a j ≠ 9 , which has probability 9 / 10 .    □
When t consists of nines the required number of carries is forced; when t has small or mixed digits, matching it is a coin flip (for example ρ ( 45 ) = ρ ( 63 ) = 0.444 ). Figure 6 shows the resulting carry resonance.
Treating s ( a ) = t , the parity of a and the carries as independent gives the resonance approximation
T ( D ) 10 D ≈ 1 2 ∑ t ≡ 9 ( 18 ) P D ( t ) ρ ( t ) ,
where P D ( t ) is the probability that a random D-digit string has digit sum t. Table 3 compares it with the exact values: the error is below 10 − 4 for 12 ≤ D ≤ 200 and below 2 · 10 − 6 for 100 ≤ D ≤ 200 .
Table 3. Proportion T ( D ) / 10 D of integers below 10 D that are the odd point of a 2-cycle: exact (digit dynamic programme) and resonance approximation.
Table 3. Proportion T ( D ) / 10 D of integers below 10 D that are the odd point of a 2-cycle: exact (digit dynamic programme) and resonance approximation.
D exact resonance D exact resonance
6 0.018879 0.017810 30 0.013760 0.013711
8 0.013812 0.014153 50 0.013827 0.013807
10 0.013101 0.012902 75 0.012426 0.012412
12 0.012434 0.012450 100 0.011919 0.011919
15 0.013855 0.013795 150 0.012165 0.012163
20 0.019908 0.019996 200 0.014819 0.014821
Since s ( a ) concentrates near 4.5 D , the density peaks when 4.5 D lies just below a power of ten (the relevant t end in nines) and dips in between. Evaluating the approximation up to D = 10 4 (Figure 7) gives peaks near D = 22 , 218 , 2247 with heights 0.0210 , 0.0160 , 0.0145 , and troughs near D = 554 and 5452 with values 0.0109 and 0.0098 ; at D = 10 4 the density is about 0.0096 .
Figure 7 suggests that the normalised density log 10 D T ( D ) / 10 D has no limit, with local maxima near D ≈ ( 10 j − 1 ) / 4.5 . Corollary 4 in Section 10.1 proves this and identifies the limit points exactly: the ratio lim sup / lim inf equals 301 / 11 ≈ 1.577 . Table 4 illustrates how slowly this limit is approached.
By Theorem 8, the oscillation concerns only the main term 1 2 ∑ t P D ( t ) ρ ( t ) , since its error O ( ( log D ) 2 / D ) is much smaller than the main term, which is of order ( log D ) − 1 / 2 . We evaluated the main term with a Gaussian approximation to P D (which agrees with the exact convolution to six decimal places at D = 200 , 1000 , 5000 ) up to D ≈ 6 · 10 7 . Table 4 shows that over six orders of magnitude of D the ratio between consecutive local maxima and minima stays between 1.375 and 1.413 , still well below its limit 1.577 ; Remark 3 explains why.
The mechanism is the one behind Proposition 4. The digit sum t of a random D-digit number lies within O ( D ) of 4.5 D , so its top ≈ 1 2 log 10 D digits are determined by D and only its bottom digits vary. When 4.5 D is just below 10 j , those top digits are nines; columns of a + t where t has a nine carry almost deterministically, so only the bottom half of the columns contributes to the variance of the carry count, and the probability of hitting its mean is correspondingly larger. At other values of D all columns contribute. Section 10.1 makes this precise. The variance of the carry count equals 11 9 ∑ i φ ( q i ) exactly (Lemma 8), and a sharp local limit theorem (Theorem 11) turns it into the oscillation law, Theorem 12.

9. Two-Cycles Have Density Zero

Throughout this section K , K 0 , K 1 , … denote absolute constants and c > 0 an absolute constant, not necessarily the same at each occurrence. For an integer t ≥ 1 with digits t i let
S ( t ) = i odd , i ≥ 1 : t i ∈ { 1 , … , 8 } .
For a random variable X and λ > 0 , Q ( X ; λ ) = sup x Pr ( x ≤ X ≤ x + λ ) is its concentration function. We use the Kolmogorov–Rogozin inequality [11,12]: for independent X 1 , … , X n and 0 < λ ≤ L ,
Q ∑ i X i ; L ≤ K 0 L ∑ i λ 2 1 − Q ( X i ; λ ) − 1 / 2 .
For integer-valued variables and λ = L = 1 2 , Q ( X ; 1 2 ) is the largest point probability, so (2) gives max m Pr ( ∑ i X i = m ) ≤ K 0 ∑ i ( 1 − max x Pr ( X i = x ) ) − 1 / 2 .
Lemma 3 
(Switch lemma). Let t ≥ 1 have ℓ digits, let 0 < δ ≤ 1 10 , and let a = ∑ i a i 10 i have independent digits a 0 , a 1 , … such that Pr ( a i = d ) ≥ δ for all d ∈ { 0 , … , 9 } and 1 ≤ i ≤ ℓ . Let C be the number of carries in a + t , possibly counting only the carries out of columns 0 , … , k − 1 for some fixed k > ℓ . Then for every integer m
Pr ( C = m ) ≤ K 1 δ | S ( t ) | + e − 9 δ | S ( t ) | / 8 .
Proof. 
Write c j for the carry into column j. For i ∈ S ( t ) call i a switch if a i + 1 + t i + 1 ≠ 9 , and let W be the set of switches. Since i + 1 is even, W depends only on the digits at even positions, and the events { i ∈ W } , i ∈ S ( t ) , are independent with Pr ( i ∈ W ) = 1 − Pr ( a i + 1 = 9 − t i + 1 ) ≥ 9 δ .
Condition on G = ( a j ) j ∉ W , which determines W; the digits a i , i ∈ W , remain independent with their original laws. We claim that
C = C 0 + ∑ i ∈ W ξ i , ξ i = 1 { a i ≥ θ i } ,
where C 0 and θ i ∈ { 1 , … , 9 } are functions of G. Indeed, for i ∈ W the carry c i + 2 = 1 { a i + 1 + t i + 1 + c i + 1 ≥ 10 } equals 1 { a i + 1 + t i + 1 ≥ 10 } , because a i + 1 + t i + 1 ≠ 9 ; so the value of a i influences no carry other than c i + 1 . Proceeding upwards through the columns, every carry c j with j ∉ { i + 1 : i ∈ W } is therefore a function of G. In particular, for i ∈ W the carry c i into column i is a function of G (as i − 1 is even, i ≠ i ′ + 1 for i ′ ∈ W ), and c i + 1 = 1 { a i ≥ θ i } with θ i = 10 − t i − c i . Since t i ∈ { 1 , … , 8 } , θ i ∈ { 1 , … , 9 } , which proves the claim; truncating the count at column k − 1 only changes C 0 .
Given G, each ξ i is Bernoulli with Pr ( ξ i = 1 ∣ G ) = Pr ( a i ≥ θ i ) ∈ [ δ , 1 − δ ] , so 1 − max x Pr ( ξ i = x ∣ G ) ≥ δ . By (2), Pr ( C = m ∣ G ) ≤ K 0 ( δ | W | ) − 1 / 2 . By the multiplicative Chernoff bound [2], Pr ( | W | < 9 2 δ | S ( t ) | ) ≤ e − 9 δ | S ( t ) | / 8 . On the complementary event, Pr ( C = m ∣ G ) ≤ K 0 ( 9 2 δ 2 | S ( t ) | ) − 1 / 2 , and the lemma follows.    □
Lemma 4 
(Sampling). Let x 0 , … , x D − 1 be a uniformly random arrangement of a multiset of D digits with counts N 0 , … , N 9 , and let y 0 , y 1 , … be independent with Pr ( y i = d ) = N d / D . For k ≤ D , the laws of ( x 0 , … , x k − 1 ) and ( y 0 , … , y k − 1 ) are within total variation distance k ( k − 1 ) / ( 2 D ) .
Proof. 
Realise both by drawing balls from an urn of D labelled balls, without and with replacement. The two procedures can be coupled to agree unless a ball is drawn twice with replacement, which has probability at most k 2 / D  [1].    □
Lemma 5 
(Low digits of the digit sum). Let a be uniform in { 0 , … , 10 D − 1 } and t = s ( a ) . There is K 2 such that for every modulus M ≥ 1 the law of t mod M is within total variation distance K 2 M / D of the uniform law on { 0 , … , M − 1 } . (We use M = 10 h and M = 9 · 10 h .)
Proof. 
The law of t is the D-fold convolution of the uniform law on { 0 , … , 9 } . Convolutions of log-concave sequences are log-concave [10], so it is unimodal, and by (2) its largest point probability is p max ≤ K / D . For a unimodal sequence, the sums over any two residue classes modulo M differ by at most p max , so each residue class has probability within p max of 1 / M . Summing over the M classes gives the bound.    □
Theorem 7 
(Zero density of 2-cycles). There is an absolute constant K such that for all D ≥ 2
T ( D ) 10 D ≤ K log D .
Proof. 
Let a be uniform in { 0 , … , 10 D − 1 } , with digit counts N = ( N d ) and t = s ( a ) , and let E be the event that a is the odd point of a 2-cycle. By Theorem 5, E ⊆ { C ( a , t ) = m ( t ) } with m ( t ) = s ( t ) / 9 . Let ℓ be the number of digits of 9 D , so t < 10 ℓ . Choose
h = log 10 D log D , r = ⌈ 4 log 10 D ⌉ , k = ℓ + r ,
Typical multisets. Let A = { N d ≥ D / 20 for all d } . By the Chernoff bound, Pr ( A c ) ≤ 10 e − c D .
Many switches. Let U = { | S ( t ) ∩ [ 1 , h ) | ≥ h / 5 } . Under the uniform law on { 0 , … , 10 h − 1 } , the digits in the odd positions 1 , 3 , … below h are independent and uniform, each in { 1 , … , 8 } with probability 4 / 5 ; their number is about h / 2 , so fewer than h / 5 of them lie in { 1 , … , 8 } with probability at most e − c h . By Lemma 5, Pr ( U c ) ≤ e − c h + K 2 10 h / D ≤ e − c h + K 2 / log D .
Conditional bound. Fix N ∈ A with t = ∑ d d N d satisfying U. Given N, the string a is a uniformly random arrangement of the multiset. Let C ( k ) count the carries of a + t out of columns 0 , … , k − 1 . Columns ℓ , … , k − 1 have t-digit 0, so a carry passes column k − 1 only if a ℓ = … = a k − 1 = 9 ; given N ∈ A this has probability at most ( 11 / 20 + k / D ) r ≤ ( 3 / 5 ) r for large D. Hence Pr ( E ∣ N ) ≤ Pr ( C ( k ) = m ( t ) ∣ N ) + ( 3 / 5 ) r . By Lemma 4, replacing ( a 0 , … , a k − 1 ) by independent digits with law N d / D ≥ 1 / 20 changes this probability by at most k ( k − 1 ) / ( 2 D ) ≤ k 2 / ( 2 D ) , and by Lemma 3 with δ = 1 / 20 and | S ( t ) | ≥ h / 5 ,
Pr ( E ∣ N ) ≤ K 3 h + e − c h + k 2 2 D + ( 3 / 5 ) r .
Conclusion. Since h ≥ 1 2 log 10 D − log 10 log D − 1 , k = O ( log D ) and ( 3 / 5 ) r ≤ D 4 log 10 ( 3 / 5 ) ≤ D − 0.88 (note 4 log 10 ( 3 / 5 ) ≈ − 0.887 ),
T ( D ) 10 D = Pr ( E ) ≤ Pr ( A c ) + Pr ( U c ) + sup N ∈ A ∩ U Pr ( E ∣ N ) = O ( log D ) − 1 / 2 .
   □
Corollary 2. 
The number of 2-cycles whose odd point is below N is O N / log log N . In particular the proportion of multiples of 9 below N that lie on a 2-cycle tends to 0, so the number of 2-cycles does not grow linearly in N.
Proof. 
Take D = ⌈ log 10 N ⌉ in Theorem 7; every point of a 2-cycle is a multiple of 9 by Theorem 5.    □
Remark 2 
(Why the decay is so slow). The proof shows where the mechanism lives. The decision “exactly s ( t ) / 9 carries” is made in the lowest ≈ log 10 t columns of a + t , and only the columns where t has a digit strictly between 0 and 9 act as independent switches. With t ≈ 4.5 D there are only O ( log D ) such columns, so the carry count has standard deviation of order log D and hits a prescribed value with probability of order ( log D ) − 1 / 2 . When t consists mostly of nines the switches disappear and the probability stays near 9 / 10 (Proposition 4); averaged over the spread of t, this produces the resonance peaks of Figure 7.
The same tools turn the resonance approximation into a theorem.
Theorem 8 
(Resonance asymptotics).
T ( D ) 10 D = 1 2 ∑ t ≡ 9 ( mod 18 ) P D ( t ) ρ ( t ) + O ( log D ) 2 D ,
where P D ( t ) is the probability that D uniform random digits sum to t.
Proof. 
Condition on the digit counts N, which fixes t; if t ≢ 9 ( mod 18 ) then E is empty, since s ( t ) / 9 must be an integer and t odd. Otherwise E = { a 0 odd , C ( a , t ) = m ( t ) } . With k = ℓ + r as above, replace C by C ( k ) at cost ( 3 / 5 ) r , and replace the arrangement by independent digits with law N d / D at cost k 2 / ( 2 D ) (Lemma 4). On the event max d | N d / D − 1 10 | ≤ log D / D , whose complement has probability O ( D − 2 ) by Hoeffding’s inequality, the product of these k laws is within total variation O ( k log D / D ) of the product of uniform laws. Under uniform digits, Pr ( a 0 odd , C ( k ) = m ( t ) ) = 1 2 ρ k ( t ) , where ρ k is ρ computed with k columns, and | ρ k ( t ) − ρ ( t ) | ≤ 10 − r . Averaging over N gives the main term with total error O k log D / D + k 2 / D + ( 3 / 5 ) r + 10 − r . Since r = ⌈ 4 log 10 D ⌉ we have ( 3 / 5 ) r ≤ D − 0.88 = o ( D − 1 / 2 ) and 10 − r ≤ D − 4 , and since k = O ( log D ) the total is O ( ( log D ) 2 / D ) .    □
Numerically the error in Theorem 8 is far smaller than this bound: at most 2 · 10 − 6 for 100 ≤ D ≤ 200 (Table 3).

10. Carry Balance and the Exact Order of the 2-Cycle Density

The upper bound of Theorem 7 leaves open why 2-cycles are common at all. The answer is an exact identity: the number of carries that a 2-cycle demands is the expected number of carries.
Theorem 9 
(Carry balance). Let t ≥ 0 , let K be at least the number of digits of t, and let C K ( a , t ) count the carries out of columns 0 , … , K − 1 in a + t . If a is uniform on { 0 , … , 10 K − 1 } , then
E C K ( a , t ) = s ( t ) − t 10 − K 9 .
If instead a is uniform on the odd numbers in { 0 , … , 10 K − 1 } and t is odd with t < 10 K , then
E C K ( a , t ) = s ( t ) + 1 − ( t + 1 ) 10 − K 9 .
Proof. 
Let b = ( a + t ) mod 10 K and ω = 1 { a + t ≥ 10 K } , so s ( a + t ) = s ( b ) + ω . Lemma 1 gives 9 C K ( a , t ) = s ( a ) + s ( t ) − s ( b ) − ω . If a is uniform, so is b, hence E s ( a ) = E s ( b ) , and Pr ( ω = 1 ) = t / 10 K . If a is uniform on the 10 K / 2 odd numbers and t is odd, then b is uniform on the even numbers; their units digits average 5 and 4 respectively while the other digits are uniform, so E s ( a ) − E s ( b ) = 1 . Overflow occurs iff a ≥ 10 K − t ; as 10 K − t and 10 K − 1 are both odd, exactly ( t + 1 ) / 2 odd values of a qualify, so Pr ( ω = 1 ) = ( t + 1 ) / 10 K .    □
Both formulas were confirmed by exhaustive enumeration for K = 4 and several values of t.
Corollary 3 
(A 2-cycle is a carry count near its mean). Let a be odd with t = s ( a ) ≡ 9 ( mod 18 ) . Then a lies on a 2-cycle if and only if C ( a , t ) = s ( t ) / 9 . For every K > log 10 t , this required value differs from the mean E C K ( a ′ , t ) over uniformly random odd a ′ < 10 K by 1 − ( t + 1 ) 10 − K / 9 ∈ [ 0 , 1 / 9 ) ; the difference is 0 exactly when t + 1 = 10 K .
This is the conceptual reason for everything in Section 8 and Section 9: the carry count is a sum of about log 10 t weakly dependent terms, so it equals its mean with probability of order ( log t ) − 1 / 2 (Figure 8), except when the digits of t are almost all 9, where the count is nearly deterministic and the probability is close to 9 / 10 . We now turn this into a sharp theorem.
Lemma 6 
(Variance of carries). Let t ≥ 0 and let a 0 , a 1 , … , a k − 1 be independent digits, where a 0 may have any law and Pr ( a i = d ) ≥ δ for all d ∈ { 0 , … , 9 } and 1 ≤ i ≤ k − 1 . Let c j be the carry out of column j − 1 ( 1 ≤ j ≤ k ), so that C k ( a , t ) = ∑ j = 1 k c j . Then
| Cov ( c i , c j ) | ≤ ( 1 − 9 δ ) j − i ( 1 ≤ i < j ≤ k ) , Var C k ( a , t ) ≤ 1 + 2 9 δ k .
Proof. 
Fix 1 ≤ i < j ≤ k . The carry c j is a function of c i and of the digits in columns i , … , j − 1 , all of which are at least 1 and independent of c i . Run the carry recursion through these columns twice with the same digits, once from carry-in 0 and once from carry-in 1. In column l the two runs produce the same carry-out unless a l + t l = 9 , an event of probability Pr ( a l = 9 − t l ) ≤ 1 − 9 δ ; once the runs agree they agree forever. Hence, with Δ = Pr ( c j = 1 ∣ c i = 1 ) − Pr ( c j = 1 ∣ c i = 0 ) , 0 ≤ Δ ≤ ( 1 − 9 δ ) j − i by independence of the columns. Since Cov ( c i , c j ) = Var ( c i ) Δ and Var ( c i ) ≤ 1 4 , the covariance bound follows (with room to spare). Note that a 0 is never used: column 0 only influences c 1 , and the bound for pairs involving c 1 uses columns 1 , … , j − 1 . Finally
Var C k ≤ ∑ j = 1 k Var ( c j ) + 2 ∑ i < j ( 1 − 9 δ ) j − i ≤ k 4 + 2 k ∑ d ≥ 1 ( 1 − 9 δ ) d ≤ 1 + 2 9 δ k .
   □
Lemma 7 
(Local lower bound for switch sums). Let ξ 1 , … , ξ n be independent Bernoulli variables with success probabilities p i ∈ [ δ , 1 − δ ] , and let S = ∑ i ξ i , μ = ∑ i p i , V = ∑ i p i ( 1 − p i ) . For every A > 0 there are constants c A , δ > 0 and n A , δ , depending only on A and δ, such that for all n ≥ n A , δ , all such p 1 , … , p n and every integer x with | x − μ | ≤ A n ,
Pr ( S = x ) ≥ c A , δ n .
Proof. 
Note δ ( 1 − δ ) n ≤ V ≤ n / 4 .
(a) Unimodality. The generating polynomial ∏ i ( 1 − p i + p i z ) has only real roots, so its coefficients Pr ( S = j ) form a log-concave, hence unimodal, sequence [10].
(b) Normal approximation. By the Berry–Esseen inequality for independent, non-identically distributed summands [11], sup y | Pr ( S ≤ y ) − Φ ( ( y − μ ) / V ) | ≤ C 0 ∑ i E | ξ i − p i | 3 / V 3 / 2 ≤ C 0 / V , since E | ξ i − p i | 3 ≤ p i ( 1 − p i ) .
(c) Mass on each side. Let w = ⌈ V ⌉ , J − = { x − w , … , x − 1 } and J + = { x + 1 , … , x + w } . In standard units | x − μ | / V ≤ A ′ : = A / δ ( 1 − δ ) , and each of J ± corresponds to an interval of length at least 1 − 1 / V within distance A ′ + 2 of 0. By (b), Pr ( S ∈ J ± ) ≥ η − 2 C 0 / V with η = 1 2 φ ( A ′ + 2 ) , where φ is the standard normal density; this is at least η / 2 once n is large in terms of A , δ .
(d) Point mass. Let M be a mode of S. If M ≥ x , unimodality gives Pr ( S = y ) ≤ Pr ( S = x ) for all y ∈ J − , so η / 2 ≤ Pr ( S ∈ J − ) ≤ w Pr ( S = x ) . If M < x , the same argument applies to J + . In both cases Pr ( S = x ) ≥ η / ( 2 w ) ≥ η / ( 4 V ) ≥ η / ( 2 n ) .    □
Theorem 10 
(Exact order of the 2-cycle density). There are absolute constants c , K > 0 and D 0 such that for all D ≥ D 0
c log D ≤ T ( D ) 10 D ≤ K log D .
Equivalently, the number of 2-cycles with odd point below N is of exact order N / log log N .
  • Plan of the lower bound.
The proof conditions in three nested layers. Each layer fixes part of the randomness and keeps the rest independent, and Table 5 lists the objects involved.
  • Digit counts. Fixing the multiset N of digits of a fixes t = s ( a ) and the target m = s ( t ) / 9 . Given N, the arrangement of the digits is uniform. By Lemma 4, its lowest k = O ( log D ) digits may be replaced by independent digits with law p d = N d / D , at a cost of k 2 / ( 2 D ) .
  • Non-switch digits. Under the independent law we condition on G, which consists of all digits except those at the active switches W. The set W is a function of G: whether i ∈ S ( t ) is active depends only on a i + 1 , and i + 1 is even, so it is never itself a switch. The remaining digits a i , i ∈ W , are independent of G and of each other, and each influences only the carry out of its own column. Therefore C k = C 0 + ∑ i ∈ W ξ i with C 0 determined by G and independent Bernoulli summands ξ i .
  • Good conditionings. Two events determined by G make the local estimate applicable. B 1 says that the conditional mean C 0 + μ W is within 2 R k of m. It has probability at least 1 2 because the unconditional carry count is concentrated near m (carry balance and the variance lemma) and the Bernoulli part is concentrated near its mean. B 2 says that | W | is of order h; it fails with probability e − Ω ( h ) by the Chernoff bound. On B 1 ∩ B 2 the target x = m − C 0 of the Bernoulli sum lies within A | W | of its mean, with A bounded because k = O ( h ) . Lemma 7 then gives probability of order 1 / | W | ≍ 1 / log D .
Table 5. The objects in the proof of the lower bound in Theorem 10.
Table 5. The objects in the proof of the lower bound in Theorem 10.
object determined by role
N, t, m digit multiset fixes the target; arrangement uniform given N
A ′ , U ′ N typical counts; t ≡ 9 (mod 18) with ≥ h / 5 switch positions
p N independent-digit approximation of the low digits
W ⊆ S ( t ) digits at even positions (part of G) active switches: a i + 1 + t i + 1 ≠ 9
G all digits outside W (incl. a 0 ) fixes C 0 and the thresholds θ i
ξ i , i ∈ W a i independent Bernoulli given G, parameters in [ δ , 1 − δ ]
B 1 , B 2 G conditional mean near m; many switches
x = m − C 0 G target for ∑ ξ i , within the local-limit window
Proof. 
The upper bound is Theorem 7. For the lower bound we keep the notation of its proof: ℓ is the number of digits of 9 D , h = ⌊ log 10 ( D / log D ) ⌋ , r = ⌈ 4 log 10 D ⌉ , k = ℓ + r and δ = 1 / 20 . For large D,
1 4 log 10 D ≤ h , k ≤ 6 log 10 D .
All constants below depend only on δ and on absolute constants, never on D.
Step 1: typical digit counts and digit sums. Let A ′ be the event max d | N d / D − 1 10 | ≤ log D / D ; by Hoeffding’s inequality Pr ( A ′ c ) = O ( D − 2 ) . Let U ′ be the event that t ≡ 9 ( mod 18 ) and | S ( t ) ∩ [ 1 , h ) | ≥ h / 5 . Both conditions depend only on t mod 9 · 10 h . Under the uniform law on Z / 9 · 10 h ≅ Z / 9 × Z / 10 h , the residue mod 9 is uniform and independent of the last h digits, so t ≡ 0 ( mod 9 ) has probability 1 / 9 ; the units digit is odd with probability 1 / 2 ; and, independently of the units digit, at least h / 5 of the roughly h / 2 odd positions below h carry a digit in { 1 , … , 8 } with probability at least 1 − e − c 1 h . By Lemma 5 with M = 9 · 10 h ,
Pr ( U ′ ) ≥ 1 18 1 − e − c 1 h − K 2 9 · 10 h D ≥ 1 20 for large D .
Step 2: reduction to independent digits. Fix digit counts N in A ′ such that t = t ( N ) satisfies U ′ , and let m = s ( t ) / 9 . Then p d = N d / D ≥ 1 / 20 for all d. Given N, a is a uniform arrangement, and E ⊇ { a 0 odd , C k ( a , t ) = m } ∖ F , where F is the event that a carry passes column k − 1 ; as in Theorem 7, Pr ( F ∣ N ) ≤ ( 3 / 5 ) r . By Lemma 4,
Pr ( E ∣ N ) ≥ Pr p a 0 odd , C k = m − k 2 2 D − ( 3 / 5 ) r ,
where Pr p refers to independent digits with law p. We bound the first term from below by Pr p ( a 0 odd ) · Pr p ( C k = m ∣ a 0 odd ) with Pr p ( a 0 odd ) ≥ 1 2 − 5 log D / D ≥ 1 4 .
Step 3: the carry count is concentrated near m. Let X = C k under Pr p ( · ∣ a 0 odd ) . Under uniform digits with a 0 odd, Theorem 9 gives E X = m + 1 − ( t + 1 ) 10 − k / 9 . The laws of ( a 0 , … , a k − 1 ) under p and under the uniform law (both conditioned on a 0 odd) differ in total variation by at most 10 k log D / D , and 0 ≤ X ≤ k , so the mean changes by at most 10 k 2 log D / D = o ( 1 ) . Hence | E X − m | ≤ 1 for large D. By Lemma 6, which allows column 0 to have an arbitrary law (here: uniform on the odd digits) and requires Pr ( a i = d ) ≥ δ only for 1 ≤ i ≤ k − 1 , we have Var X ≤ K 3 k with K 3 = 1 + 2 / ( 9 δ ) . Put R = max ( 1 , 4 K 3 ) . Chebyshev’s inequality gives, for k ≥ 4 ,
Pr | X − m | > R k ≤ Pr | X − E X | > R k − 1 ≤ K 3 k ( R k / 2 ) 2 ≤ 1 4 .
Step 4: switches. Condition on G, the digits outside the switch set W of Lemma 3 (with a 0 included in G). Then X = C 0 + ∑ i ∈ W ξ i , where C 0 is a function of G and, given G, the ξ i are independent Bernoulli variables with success probabilities p i ∈ [ δ , 1 − δ ] . Write μ W = ∑ i ∈ W p i and Y = ∑ i ∈ W ξ i − μ W . Since Var ( Y ∣ G ) ≤ | W | / 4 ≤ k / 4 , Chebyshev’s inequality gives Pr ( | Y | > R k ) ≤ 1 / ( 4 R 2 ) ≤ 1 / 4 . As C 0 + μ W − m = ( X − m ) − Y , the event
B 1 = | C 0 + μ W − m | ≤ 2 R k ,
which is determined by G, satisfies Pr ( B 1 ) ≥ 1 − 1 4 − 1 4 = 1 2 . Let B 2 = { | W | ≥ w 0 } with w 0 = 9 2 δ · h 5 ; also determined by G. Since | S ( t ) | ≥ h / 5 , the Chernoff bound in Lemma 3 gives Pr ( B 2 c ) ≤ e − 9 δ h / 40 . Hence
Pr ( B 1 ∩ B 2 ) ≥ 1 2 − e − 9 δ h / 40 ≥ 1 4 for large D .
Step 5: local lower bound. On B 1 ∩ B 2 , the target value x = m − C 0 satisfies | x − μ W | ≤ 2 R k ≤ A | W | , where A = 2 R k / w 0 is bounded by an absolute constant because of (4). Since | W | ≥ w 0 → ∞ , Lemma 7, applied conditionally on G, gives
Pr ( X = m ∣ G ) = Pr ∑ i ∈ W ξ i = x | G ≥ c A , δ | W | ≥ c A , δ k
uniformly on B 1 ∩ B 2 . Therefore Pr p ( C k = m ∣ a 0 odd ) ≥ 1 4 c A , δ / k ≥ c 4 / log D by (4).
Step 6: conclusion. Combining with (5) and Step 2, for every admissible N, Pr ( E ∣ N ) ≥ 1 4 c 4 / log D − k 2 / ( 2 D ) − ( 3 / 5 ) r ≥ c 5 / log D for large D. Averaging over N,
T ( D ) 10 D = Pr ( E ) ≥ Pr ( A ′ ∩ U ′ ) · c 5 log D ≥ 1 20 − O ( D − 2 ) c 5 log D ≥ c log D .
   □
Figure 9. The 2-cycle density multiplied by ln D stays between positive bounds, as Theorem 10 asserts; the log-periodic modulation of Figure 7 remains.
Figure 9. The 2-cycle density multiplied by ln D stays between positive bounds, as Theorem 10 asserts; the log-periodic modulation of Figure 7 remains.
Preprints 242433 g009

10.1. The Oscillation Law

We now determine the normalised density exactly, up to a factor 1 + o ( 1 ) . This proves that it oscillates, identifies its limit points and shows that the limiting peak-to-trough ratio is 301 / 11 ≈ 1.577 , well above the values near 1.4 seen in Table 4. Three new ingredients are needed: an exact formula for the variance of the carry count, a sharp extremal bound for the digit averages that this formula involves, and a local limit theorem with the sharp constant.
Throughout this subsection a has independent digits, a 0 uniform on { 1 , 3 , 5 , 7 , 9 } and a i uniform on { 0 , … , 9 } for i ≥ 1 . For t ≥ 0 let c i ( i ≥ 1 ) be the carry into column i of a + t , let q i = Pr ( c i = 1 ) , and let C = C ( a , t ) = ∑ i ≥ 1 c i . Then ρ ( t ) = Pr ( C = s ( t ) / 9 ) . Write { y } for the fractional part of a real number y and
φ ( x ) = x ( 1 − x ) .
Lemma 8 
(Exact carry variance). For every t ≥ 0 and 1 ≤ i ≤ j ,
q i + 1 = t i + q i 10 , Cov ( c i , c j ) = 10 − ( j − i ) q i ( 1 − q i ) , Var C = 11 9 ∑ i ≥ 1 φ ( q i ) .
Moreover | q i − { t / 10 i } | ≤ 10 1 − i for all i ≥ 1 .
Proof. 
Given c i = c , column i carries out iff a i ≥ 10 − t i − c , which has probability ( t i + c ) / 10 (also when t i + c = 10 ). So E [ c i + 1 ∣ c 1 , … , c i ] = ( t i + c i ) / 10 . Taking expectations gives the recursion for q i . Subtracting it gives E [ c i + 1 − q i + 1 ∣ c 1 , … , c i ] = ( c i − q i ) / 10 , and by induction E [ c j − q j ∣ c 1 , … , c i ] = 10 − ( j − i ) ( c i − q i ) . Multiplying by c i − q i and taking expectations gives the covariance. Above the top digit of t we have t i = 0 and q i + 1 = q i / 10 , so ∑ i q i < ∞ and all the series below converge absolutely. Hence
Var C = ∑ i φ ( q i ) 1 + 2 ∑ d ≥ 1 10 − d = 11 9 ∑ i φ ( q i ) .
Finally x i = { t / 10 i } = ( t mod 10 i ) / 10 i satisfies x 1 = t 0 / 10 and x i + 1 = ( t i + x i ) / 10 , so q i − x i = 10 1 − i ( q 1 − x 1 ) , and | q 1 − x 1 | ≤ 1 .    □
So the variance of the carry count is an additive functional of the fractional parts { t / 10 i } . A digit 9 or 0 in t pushes the next fractional part towards 1 or 0, where φ vanishes. This is the exact form of the resonance mechanism.
Lemma 9 
(Extremal digit averages). Let x 1 ∈ [ 0 , 1 ] , let d 1 , … , d n ∈ { 0 , … , 9 } and x i + 1 = ( d i + x i ) / 10 . Then
∑ i = 1 n φ ( x i ) ≤ 30 121 n + 5 22 .
The constant 30 / 121 is best possible: for the digits 4 , 5 , 4 , 5 , … the points x i converge to the 2-cycle { 5 / 11 , 6 / 11 } , where φ = 30 / 121 .
Proof. 
Put u i = x i − 1 2 ∈ [ − 1 2 , 1 2 ] and e i = d i − 9 2 , so that u i + 1 = ( e i + u i ) / 10 and | e i | ≥ 1 2 . For α = 1 11 , β = 1 110 and all real u and e with | e | ≥ 1 2 , minimising over u gives
α u 2 + β ( u + e ) 2 ≥ α β α + β e 2 = e 2 121 ≥ 1 484 .
With u = u i , e = e i and β ( u i + e i ) 2 = 10 11 u i + 1 2 this reads u i 2 − 1 484 ≥ 10 11 u i 2 − u i + 1 2 . Summing, ∑ i = 1 n u i 2 ≥ n 484 − 10 11 · 1 4 . Since φ ( x i ) = 1 4 − u i 2 , the bound follows. The 2-cycle: the composition x ↦ ( 4 + ( 5 + x ) / 10 ) / 10 fixes 5 / 11 , and ( 5 + 5 / 11 ) / 10 = 6 / 11 .    □
Lemma 10 
(Smoothness of Bernoulli sums). Let S be a sum of n ≥ 1 independent Bernoulli variables with success probabilities in [ δ , 1 − δ ] . Then for every integer x
| Pr ( S = x + 1 ) − Pr ( S = x ) | ≤ π 4 δ ( 1 − δ ) n .
Proof. 
Let ψ ( θ ) = E e i θ S . For each summand, | 1 − p + p e i θ | 2 = 1 − 2 p ( 1 − p ) ( 1 − cos θ ) ≤ exp ( − 4 δ ( 1 − δ ) θ 2 / π 2 ) for | θ | ≤ π , using 1 − cos θ ≥ 2 θ 2 / π 2 . So | ψ ( θ ) | ≤ e − c n θ 2 with c = 2 δ ( 1 − δ ) / π 2 . By Fourier inversion,
| Pr ( S = x + 1 ) − Pr ( S = x ) | = 1 2 π ∫ − π π e − i x θ ( e − i θ − 1 ) ψ ( θ ) d θ ≤ 1 2 π ∫ − ∞ ∞ | θ | e − c n θ 2 d θ = 1 2 π c n .
   □
Theorem 11 
(Sharp local limit theorem for carries). For every λ ∈ ( 0 , 1 ] and ε > 0 there is n 0 with the following property. Let t have ℓ digits and suppose its switch set S ( t ) (Lemma 3) has | S ( t ) | ≥ max ( n 0 , λ ℓ ) . Then V = Var C and μ = E C satisfy, for every integer m with | m − μ | ≤ 1 ,
2 π V Pr ( C = m ) − 1 ≤ ε .
Proof. 
Let p ( x ) = Pr ( C = x ) and δ = 1 10 .
Size of V. Lemma 3 (whose proof applies to the full carry count) gives C = C 0 + ∑ i ∈ W ξ i , where, given the digits G outside W, the ξ i are independent Bernoulli variables with parameters in [ δ , 1 − δ ] , and Pr ( i ∈ W ) ≥ 9 δ independently over i ∈ S ( t ) . Hence V ≥ E Var ( C ∣ G ) ≥ δ ( 1 − δ ) E | W | ≥ 0.08 | S ( t ) | . In the other direction, Lemma 8 gives V ≤ 11 9 ( ℓ 4 + ∑ i > ℓ q i ) ≤ ℓ / 3 + 1 ≤ ( 1 / λ + 1 ) | S ( t ) | , because q i ≤ 10 ℓ − i for i > ℓ .
Smoothness. Given G, p ( · ∣ G ) is a shift of the law of a Bernoulli sum with | W | terms, so Lemma 10 and the Chernoff bound Pr ( | W | < 9 2 δ | S ( t ) | ) ≤ e − 9 δ | S ( t ) | / 8 give
sup x | p ( x + 1 ) − p ( x ) | ≤ L : = K | S ( t ) | + e − | S ( t ) | / 90
for an absolute constant K.
Central limit theorem. (General local limit theorems for non-homogeneous chains [5] assume uniform ellipticity, which fails here when t i ∈ { 0 , 9 } ; we therefore combine a central limit theorem with the smoothing above.) The carries c 1 , c 2 , … form a non-homogeneous Markov chain on { 0 , 1 } . Its i-th transition matrix has rows ( 1 − t i 10 , t i 10 ) and ( 1 − t i + 1 10 , t i + 1 10 ) , so its Dobrushin contraction coefficient δ i = 1 2 ∑ y | P i ( 0 , y ) − P i ( 1 , y ) | equals 1 10 , for every i and every t; the ergodic coefficient is α i = 1 − δ i = 9 10 . We use Dobrushin’s theorem in the form of Sethuraman and Varadhan [9]. For a triangular array of non-homogeneous Markov chains X 1 ( n ) , … , X k n ( n ) and functions f i ( n ) with | f i ( n ) | ≤ C n , let α n be the smallest ergodic coefficient in row n and S n = ∑ i f i ( n ) ( X i ( n ) ) . If C n 2 α n − 3 / ∑ i Var f i ( n ) ( X i ( n ) ) → 0 , then ( S n − E S n ) / Var S n converges in law to the standard normal. In our case f i ( c ) = c , C n = 1 and α n = 9 10 , and ∑ i Var c i = ∑ i φ ( q i ) = 9 11 V by Lemma 8. So the condition is simply V → ∞ .
To make this uniform in t, suppose it fails. Then there are ε ′ > 0 and digit strings t ( n ) with V ( t ( n ) ) → ∞ such that sup y | Pr ( C ≤ μ + y V ) − Φ ( y ) | > ε ′ for every n. Truncate the n-th chain after column k n = ℓ n + r n with r n → ∞ . This changes C with probability at most ∑ i > k n q i ≤ 10 − r n , and changes V by a factor 1 + o ( 1 ) . The array of truncated chains satisfies the condition above, so ( C − μ ) / V converges in law to N ( 0 , 1 ) along t ( n ) . By Pólya’s theorem the convergence is uniform in y, because Φ is continuous. This contradicts the choice of t ( n ) . Hence for every ε ′ > 0 there is V 0 with sup y | Pr ( C ≤ μ + y V ) − Φ ( y ) | ≤ ε ′ whenever V ( t ) ≥ V 0 .
Combination. Fix η ∈ ( 0 , 1 ) and let J = { x ∈ Z : | x − m | ≤ η V } , so | J | − 2 η V ≤ 1 . For x ∈ J , | p ( x ) − p ( m ) | ≤ L η V , so ∑ x ∈ J p ( x ) − | J | p ( m ) ≤ | J | L η V . Since | m − μ | ≤ 1 , the central limit theorem gives ∑ x ∈ J p ( x ) = 2 η ϕ ( 0 ) 1 + O ( η 2 + V − 1 / 2 ) + O ( ε ′ ) , with ϕ ( 0 ) = 1 / 2 π . Dividing by | J | ,
V p ( m ) = ϕ ( 0 ) 1 + O ( η 2 + V − 1 / 2 ) + O ε ′ η + 1 η V + O ( L η V ) .
By the bounds on V, L η V ≤ K ′ η / λ once | S ( t ) | is large. Choose η so small that the η -terms are below ε / 3 , then ε ′ = ε η / 3 , and then n 0 so large that V ≥ 0.08 n 0 ≥ V 0 and the remaining terms are below ε / 3 .    □
Theorem 12 
(Oscillation law). Let h = h D = ⌊ log 10 ( D / log D ) ⌋ and
B D = ∑ i > h φ { 4.5 D / 10 i } .
Then, as D → ∞ ,
T ( D ) 10 D = 1 + o ( 1 ) 36 22 π 9 h 6 + B D .
  • Error budget.
The main term is of order ( log D ) − 1 / 2 . Table 6 lists the five sources of error in the proof, each of which is smaller than the main term.
Proof. 
By Theorem 8 it suffices to evaluate 1 2 ∑ t ≡ 9 ( 18 ) P D ( t ) ρ ( t ) up to a factor 1 + o ( 1 ) ; the error there is O ( ( log D ) 2 / D ) , while the claimed main term is of order ( log D ) − 1 / 2 . Let ε D = ( log D ) − 1 / 8 and x i ( y ) = { y / 10 i } . Call t ≡ 9 ( mod 18 )  good if
(G1)
| t − 4.5 D | ≤ D log D ;
(G2)
| S ( t ) ∩ [ 1 , h ) | ≥ h / 5 ;
(G3)
∑ i = 1 h φ ( x i ( t ) ) − h / 6 ≤ ε D h .
Bad t are negligible. (G1) fails with probability e − c log 2 D . Conditions (G2), (G3) and t ≡ 9 ( mod 18 ) depend only on t mod 9 · 10 h , whose law is within total variation 9 K 2 10 h / D ≤ 9 K 2 / log D of uniform (Lemma 5). Under the uniform law, t ≡ 0 ( mod 9 ) and t odd have probability 1 18 jointly, and independently of them the digits t 1 , … , t h − 1 are uniform and independent. Then (G2) fails with probability e − c h , as in Theorem 7. For (G3), each x i is uniform on the grid 10 − i Z ∩ [ 0 , 1 ) , so E φ ( x i ) = 1 6 − 1 6 10 − 2 i . Also φ ( x j ) differs by at most 10 − ( j − i ) from a function of t i , … , t j − 1 , which is independent of x i ; so | Cov ( φ ( x i ) , φ ( x j ) ) | ≤ 2 · 10 − ( j − i ) and the variance of the sum is O ( h ) . By Chebyshev’s inequality (G3) fails with probability O ( 1 / ( ε D 2 h ) ) = O ( ( log D ) − 3 / 4 ) . Since ρ ≤ 1 , bad t contribute o ( ( log D ) − 1 / 2 ) .
Variance of good t. By Lemma 8, and since φ is 1-Lipschitz, V ( t ) = 11 9 ∑ i ≥ 1 φ ( x i ( t ) ) + O ( 1 ) . The terms i ≤ h contribute h / 6 + O ( ε D h ) by (G3). Let ω = ⌈ 3 log 10 log D ⌉ + 2 . The terms h < i ≤ h + ω of both ∑ i φ ( x i ( t ) ) and B D are at most ω / 4 in total. For i > h + ω , φ is 1-Lipschitz on R / Z (since φ ( 0 ) = φ ( 1 ) ), so | φ ( x i ( t ) ) − φ ( x i ( 4.5 D ) ) | ≤ | t − 4.5 D | / 10 i . By (G1) and 10 h ≥ D / ( 10 log D ) , these differences sum to at most 20 log 2 D / 10 ω ≤ 1 . Hence
V ( t ) = 11 9 h 6 + B D 1 + o ( 1 )
uniformly over good t, because h / 6 + B D ≥ h / 6 and the errors are O ( ε D h + log log D ) = o ( h ) .
Local limit. A good t has ℓ ≤ log 10 D + 2 ≤ 3 h digits for large D and | S ( t ) | ≥ h / 5 ≥ ℓ / 15 . By Theorem 9 (letting K → ∞ ) μ = E C = ( s ( t ) + 1 ) / 9 , so the target m = s ( t ) / 9 satisfies | m − μ | = 1 9 . Theorem 11 with λ = 1 15 gives ρ ( t ) = ( 1 + o ( 1 ) ) ( 2 π V ( t ) ) − 1 / 2 uniformly over good t.
Conclusion. The good t carry 1 2 P D ( good ) = 1 36 + o ( 1 ) , and on them ρ ( t ) = ( 1 + o ( 1 ) ) 22 π 9 ( h 6 + B D ) − 1 / 2 .    □
Corollary 4 
(The normalised density oscillates). Let Φ ( D ) = log 10 D T ( D ) / 10 D and K 0 = 1 / ( 12 11 π ) . Then
lim sup D → ∞ Φ ( D ) = K 0 6 ≈ 0.03472 , lim inf D → ∞ Φ ( D ) = K 0 726 301 ≈ 0.02201 ,
and the set of limit points of Φ ( D ) is the whole interval between them. Moreover Φ ( D ) → K 0 3 ≈ 0.02455 for almost all D: for every ε > 0 , the proportion of D ∈ [ 10 j , 10 j + 1 ) with | Φ ( D ) − K 0 3 | > ε tends to 0 as j → ∞ . In particular Φ ( D ) has no limit, and
lim sup Φ lim inf Φ = 301 11 = 1.5772 …
The lim sup is approached along D = ⌊ 10 j / 4.5 ⌋ , where the top digits of the typical digit sum are nines. The lim inf is approached along D = ⌊ 2 9 y j ⌋ , where y j = 4545 … has j digits. The same holds with ln D in place of log 10 D , all values multiplied by ln 10 .
Proof. 
Let ℓ D be the number of digits of ⌊ 4.5 D ⌋ . Then h / log 10 D → 1 2 and ( ℓ D − h ) / log 10 D → 1 2 . Positions i > ℓ D contribute at most ∑ i > ℓ D 10 ℓ D − i ≤ 1 9 to B D , so Lemma 9 gives 0 ≤ B D ≤ 30 121 ( ℓ D − h ) + 1 . Write B D = 1 2 log 10 D · β D . Then 0 ≤ β D ≤ 30 121 + o ( 1 ) , and Theorem 12 becomes
Φ ( D ) = 1 + o ( 1 ) 36 11 π / 9 1 6 + β D − 1 / 2 = K 0 1 6 + β D − 1 / 2 + o ( 1 ) ,
with 1 6 + 30 121 = 301 726 . For D = ⌊ 10 j / 4.5 ⌋ we have 10 j − 4.5 < 4.5 D ≤ 10 j . So φ ( { 4.5 D / 10 i } ) ≤ 4.5 · 10 − i for i ≤ j and ≤ 10 j − i for i > j , giving B D = O ( 1 ) and β D → 0 . For D = ⌊ 2 9 y j ⌋ , { 4.5 D / 10 i } lies within 6 · 10 − i of 5 / 11 or 6 / 11 for h < i ≤ j . So B D ≥ 30 121 ( j − h ) − O ( 1 ) and β D → 30 121 . Finally, | B D + 1 − B D | ≤ ∑ i > h 4.5 · 10 − i → 0 because φ is 1-Lipschitz on the circle. Hence Φ ( D + 1 ) − Φ ( D ) → 0 , and a sequence with vanishing increments that oscillates between two values has every intermediate value as a limit point.
For the typical value, let D be uniform in [ 10 j , 10 j + 1 ) and ω = ⌈ log 10 j ⌉ . Writing D = 2 u or 2 u + 1 gives ⌊ 4.5 D ⌋ = 9 u or 9 u + 4 , and u runs over more than 10 j / 2 consecutive integers. Since gcd ( 9 , 10 ) = 1 , the residue of ⌊ 4.5 D ⌋ modulo 10 j − ω is within total variation O ( 10 − ω ) of uniform. So its digits in positions h , … , j − ω are close to independent and uniform, and, as in step (G3) of the proof of Theorem 12, the sum of φ ( { 4.5 D / 10 i } ) over these positions is ( j − h ) / 6 + O P ( j ) . The top ω positions contribute O ( ω ) = o ( j ) . So β D → 1 6 in probability and Φ ( D ) → K 0 ( 1 6 + 1 6 ) − 1 / 2 = K 0 3 .    □
Figure 10. The oscillation law. (a) The main term of Theorem 12, evaluated densely near the resonances D ≈ 10 j / 4.5 and on a uniform grid in log 10 D . For most D it is close to the typical value K 0 3 . Near D = 10 j / 4.5 it spikes towards K 0 6 , and near 4.5 D ≈ 4545 … it dips towards K 0 726 / 301 . The finite-D formula overshoots K 0 6 for moderate D because h / log 10 D → 1 2 only logarithmically. Circles and squares are sampled values of the exact main term, 1 2 ∑ t P D ( t ) ρ ( t ) , at peaks and troughs, which approach the proved limits. (b) Spike shape: the law at D = ( 10 j / 4.5 ) ( 1 − 10 − r j / 2 ) , when the typical digit sum begins with about r j / 2 nines, for j = 20 , 40 , 80 . The curves rise from the typical value to the peak in the same way for every j.
Figure 10. The oscillation law. (a) The main term of Theorem 12, evaluated densely near the resonances D ≈ 10 j / 4.5 and on a uniform grid in log 10 D . For most D it is close to the typical value K 0 3 . Near D = 10 j / 4.5 it spikes towards K 0 6 , and near 4.5 D ≈ 4545 … it dips towards K 0 726 / 301 . The finite-D formula overshoots K 0 6 for moderate D because h / log 10 D → 1 2 only logarithmically. Circles and squares are sampled values of the exact main term, 1 2 ∑ t P D ( t ) ρ ( t ) , at peaks and troughs, which approach the proved limits. (b) Spike shape: the law at D = ( 10 j / 4.5 ) ( 1 − 10 − r j / 2 ) , when the typical digit sum begins with about r j / 2 nines, for j = 20 , 40 , 80 . The curves rise from the typical value to the peak in the same way for every j.
Preprints 242433 g010
Remark 3 
(Why Table 4 shows 1.4 ). The approach to the limit is logarithmically slow. At D ≈ 2 · 10 7 the random part of the digit sum has only about four digits and the deterministic part about four. The O ( 1 ) boundary terms in V ( t ) are then comparable with the main terms. Evaluating the main term by sampling 3000 digit sums from the Gaussian window, with exact integer arithmetic, at the peak D = ⌊ 10 j / 4.5 ⌋ and at the trough D = ⌊ 2 9 y j ⌋ gives ratios 1.524 ± 0.005 , 1.519 ± 0.003 , 1.526 ± 0.003 , 1.542 ± 0.002 , 1.545 ± 0.002 , 1.551 ± 0.001 , 1.562 ± 0.001 and 1.565 ± 0.001 for j = 8 , 12 , 16 , 24 , 32 , 48 , 64 , 96 . The errors are one standard error, from the sample variances by the delta method. The ratios increase towards 301 / 11 = 1.5772 . The quantity ρ ( t ) 2 π V ( t ) of Theorem 11 averages 0.9865 , 0.9948 , 0.9982 and 0.9994 over random t with 10, 30, 100 and 300 digits.

11. Other Bases

For an integer base b ≥ 2 let s b ( n ) be the base-b digit sum and
f b ( n ) = n + s b ( n ) , n odd , n − s b ( n ) , n even .
Write C b ( x , y ) and B b ( x , y ) for the numbers of carries and borrows in base b. The proof of Lemma 1 gives s b ( x + y ) = s b ( x ) + s b ( y ) − ( b − 1 ) C b ( x , y ) and s b ( x − y ) = s b ( x ) − s b ( y ) + ( b − 1 ) B b ( x , y ) , and s b ( n ) ≡ n ( mod b − 1 ) . The behaviour of f b depends sharply on the parity of b.
Theorem 13 
(Odd bases). If b is odd, every orbit of f b reaches the fixed point 0; in particular f b has no cycle other than { 0 } .
Proof. 
For odd b, b ≡ 1 ( mod 2 ) gives n ≡ s b ( n ) ( mod 2 ) . If n is odd, then s b ( n ) is odd and f b ( n ) = n + s b ( n ) is even. If n > 0 is even, then s b ( n ) is even and positive, so f b ( n ) = n − s b ( n ) is even, non-negative and strictly smaller than n. Hence after at most one step the orbit consists of even numbers that decrease strictly until they reach 0.    □
In an odd base, branching on the parity of n is the same as branching on the parity of s b ( n ) , so f b coincides with the base-b analogue of the iteration in OEIS A243260 [24]. The two rules differ only in even bases, and that is where all the structure lies.
Theorem 14 
(Even bases: structure). Let b ≥ 2 be even. Then, with 9 replaced by b − 1 and 10 by b throughout:
1. 
the parity of n is the parity of its last digit; for b ≥ 4 every term after the first even term of an orbit is a multiple of b − 1 ;
2. 
s b ( ( b − 1 ) m ) = ( b − 1 ) B b ( b m , m ) , and on multiples of b − 1 the map is conjugate to m ↦ m ± κ b ( m ) with κ b ( m ) = s b ( ( b − 1 ) m ) / ( b − 1 ) ;
3. 
the level equation of Theorem 3 holds with κ b ( k ) ;
4. 
if s b ( x ) is even and s b ( f b ( x ) + b − 1 ) = s b ( x ) , then f b ( f b ( x ) + b − 1 ) = x + b − 1 ;
5. 
an odd a lies on a 2-cycle if and only if s b ( a ) is odd and s b ( s b ( a ) ) = ( b − 1 ) C b ( a , s b ( a ) ) ;
6. 
for a uniform on { 0 , … , b K − 1 } , E C b , K ( a , t ) = s b ( t ) − t b − K / ( b − 1 ) , and for a uniform on the odd numbers there and odd t < b K , E C b , K ( a , t ) = s b ( t ) + 1 − ( t + 1 ) b − K / ( b − 1 ) ;
7. 
prefix lifting (Theorem 6) and its error bound (Corollary 1) hold with 10 L replaced by b L and 9 D by ( b − 1 ) D .
Proof. 
The proofs for b = 10 use only the carry and borrow identities, the congruence s b ( n ) ≡ n ( mod b − 1 ) , and two consequences of the evenness of b: the parity of n is that of its last digit, and b − 1 is odd, so that adding b − 1 swaps parity (used in (iv)). They therefore apply verbatim. In (vi), the odd digits 1 , 3 , … , b − 1 average b / 2 and the even digits 0 , 2 , … , b − 2 average b / 2 − 1 , so E s b ( a ) − E s b ( a + t mod b K ) = 1 , and exactly ( t + 1 ) / 2 odd a overflow. All seven statements were also checked by computer for b ∈ { 2 , 4 , 6 , 8 , 10 , 16 } .    □
Proposition 5 
(Resonance in base b). For even b and j ≥ 1 , the probability that adding t = b j − 1 to a random odd integer produces exactly s b ( t ) / ( b − 1 ) = j carries is ( b − 1 ) / b .
Proof. 
The units column gives a 0 + ( b − 1 ) ≥ b because a 0 is odd, and each of the next j − 1 columns gives a i + ( b − 1 ) + 1 ≥ b ; so all j columns carry, and the count is exactly j iff column j does not carry, i.e. a j ≠ b − 1 .    □
For b ≥ 4 the switch lemma (Lemma 3) applies with the switch digits t i ∈ { 1 , … , b − 2 } . In base 2 there are no such digits, and the switch mechanism takes a different form.
Lemma 11 
(Binary switch lemma). Let t ≥ 1 have ℓ binary digits, let 0 < δ ≤ 1 2 , and let a have independent bits with Pr ( a i = 1 ) ∈ [ δ , 1 − δ ] for 1 ≤ i ≤ ℓ . Let
S 2 ( t ) = { i ≡ 2 ( mod 4 ) , 2 ≤ i ≤ ℓ − 2 : t i − 1 ≠ t i } .
Then for every integer m, the number C of carries in a + t (possibly truncated after any fixed column k > ℓ ) satisfies Pr ( C = m ) ≤ K 1 δ − 2 | S 2 ( t ) | − 1 / 2 + e − δ 2 | S 2 ( t ) | / 8 .
Proof. 
For i ∈ S 2 ( t ) call i a switch if a i − 1 = t i − 1 and a i + 1 = t i + 1 . The column triples { i − 1 , i , i + 1 } for distinct i ∈ S 2 ( t ) are disjoint, so these events are independent, each of probability at least δ 2 . Let W be the set of switches and condition on G, the bits outside { a i : i ∈ W } ; W is determined by G.
Let i ∈ W . In column i − 1 , a i − 1 + t i − 1 = 2 t i − 1 ∈ { 0 , 2 } , so the carry into column i is c i = t i − 1 = 1 − t i whatever the carry into column i − 1 (a reset). In column i, a i + t i + c i = a i + 1 , so the carry out of column i is ξ i = a i . In column i + 1 , a i + 1 + t i + 1 ∈ { 0 , 2 } , so the carry out of column i + 1 is t i + 1 whatever ξ i is (a block). Hence a i influences only the carry ξ i , and as in Lemma 3, C = C 0 + ∑ i ∈ W ξ i with C 0 a function of G and the ξ i independent Bernoulli variables with parameters in [ δ , 1 − δ ] . The Kolmogorov–Rogozin inequality and the Chernoff bound for | W | finish the proof exactly as in Lemma 3.    □
Thus binary switches sit at the places where the bits of t change, and resonance in base 2 occurs when t = 2 j − 1 has no bit changes at all.
Theorem 15 
(Two-cycle density in every even base). For every even b ≥ 2 there are constants c b , K b > 0 and D b such that for D ≥ D b
c b log D ≤ T b ( D ) b D ≤ K b log D ,
where T b ( D ) is the number of odd a < b D on a 2-cycle of f b .
Proof. 
We go through the proofs of Theorems 7 and 10 and record each change. Fix an even b. Let a be uniform on { 0 , … , b D − 1 } , with digit counts N = ( N 0 , … , N b − 1 ) and t = s b ( a ) , and let E be the event that a is the odd point of a 2-cycle. Let ℓ be the number of base-b digits of ( b − 1 ) D , so t < b ℓ , and set
h = log b D log D , r = log D log ( 4 / 3 ) , k = ℓ + r .
Then h ≥ 1 4 log b D and k ≤ C b log D ≤ C b ′ h for large D. All constants below depend only on b.
(a) Characterisation. By Theorem 14(v),
E = { a odd , t odd , C b ( a , t ) = m ( t ) } , m ( t ) = s b ( t ) b − 1 ,
which is empty unless ( b − 1 ) ∣ s b ( t ) , i.e. ( b − 1 ) ∣ t , since s b ( t ) ≡ t ( mod b − 1 ) . In particular E ⊆ { C b ( a , t ) = m ( t ) } . Because b is even, the parity of a and of t is that of their last digit.
(b) Typical digit counts. Let A ′ be the event max d | N d / D − 1 / b | ≤ log D / D . By Hoeffding’s inequality Pr ( A ′ c ) = O b ( D − 2 ) . On A ′ , every p d = N d / D lies in [ 1 2 b , 3 4 ] for large D, so we take δ = 1 / ( 2 b ) .
(c) Overflow beyond column k − 1 . The digits of t in columns ℓ , … , k − 1 are 0, so a carry passes column k − 1 only if a ℓ = … = a k − 1 = b − 1 . Given N ∈ A ′ this has probability at most ( p b − 1 + k / D ) r ≤ ( 3 / 4 ) r ≤ D − 1 .
(d) Low digits of t. The law of t is the D-fold convolution of the uniform law on { 0 , … , b − 1 } . It is log-concave, and by (2) its largest atom is O b ( D − 1 / 2 ) . The proof of Lemma 5 then shows that t mod M is within total variation K b M / D of uniform. We use M = b h and M = ( b − 1 ) b h ; since gcd ( b − 1 , b h ) = 1 , under the uniform law on Z / ( b − 1 ) b h the residue mod b − 1 and the last h digits are independent and uniform.
(e) Switch sets. For b ≥ 4 let S ( t ) be the set of odd i < h with t i ∈ { 1 , … , b − 2 } . The proof of Lemma 3 goes through word for word with 9 replaced by b − 1 . A switch is i ∈ S ( t ) with a i + 1 + t i + 1 ≠ b − 1 , which has probability at least ( b − 1 ) δ , and the threshold θ i = b − t i − c i lies in { 1 , … , b − 1 } . Under the uniform law on the last h digits, each odd position carries a digit in { 1 , … , b − 2 } with probability ( b − 2 ) / b ≥ 1 2 , so | S ( t ) | ≥ h / 5 except with probability e − c b h . For b = 2 we use S 2 ( t ) and Lemma 11. The bits t i − 1 , t i for distinct i ≡ 2 ( mod 4 ) are disjoint pairs of uniform bits, each pair unequal with probability 1 2 , so | S 2 ( t ) | ≥ h / 16 except with probability e − c h . In both cases the conditional decomposition
C b , k ( a , t ) = C 0 + ∑ i ∈ W ξ i ,
holds, with C 0 a function of the digits G outside W and, given G, independent Bernoulli ξ i with parameters in [ δ , 1 − δ ] . For b = 2 , ξ i = a i . Moreover | W | ≥ c b ′ h except with probability e − c b ′ ′ h , by the Chernoff bound.
(f) Upper bound. Conditionally on N ∈ A ′ with | S ( t ) | (or | S 2 ( t ) | ) at least h / 16 , Lemma 4 (with b digit values; its proof does not use the number of values) replaces the first k digits by independent digits with law p at cost k 2 / ( 2 D ) . The Kolmogorov–Rogozin inequality applied to (6) then gives Pr ( C b , k = m ) ≤ K b / h . Together with (b)–(d),
T b ( D ) b D ≤ O ( D − 2 ) + e − c b h + K b b h D + K b h + k 2 2 D + D − 1 = O b ( log D ) − 1 / 2 .
(g) Lower bound. Let U ′ be the event that t is odd, t ≡ 0 ( mod b − 1 ) and the switch set below h has at least h / 16 elements. All three conditions depend only on t mod ( b − 1 ) b h . By (d) and (e), Pr ( U ′ ) ≥ 1 2 ( b − 1 ) ( 1 − e − c b h ) − K b ( b − 1 ) b h / D ≥ 1 4 ( b − 1 ) for large D. Fix N ∈ A ′ with t ( N ) ∈ U ′ and put m = s b ( t ) / ( b − 1 ) , which is an integer. As in Step 2 of Theorem 10,
Pr ( E ∣ N ) ≥ Pr p ( a 0 odd ) Pr p C b , k = m ∣ a 0 odd − k 2 2 D − D − 1 ,
and Pr p ( a 0 odd ) ≥ 1 4 .
Mean. Let X = C b , k under Pr p ( · ∣ a 0 odd ) . By Theorem 14(vi), under uniform digits E X = m + 1 − ( t + 1 ) b − k / ( b − 1 ) ∈ [ m , m + 1 ] . The change from uniform digits to law p moves the mean by at most b k 2 log D / D = o ( 1 ) , so | E X − m | ≤ 2 .
Variance. In the proof of Lemma 6, two runs of the carry recursion through column l disagree only if a l + t l = b − 1 , which has probability at most 1 − ( b − 1 ) δ . The lemma therefore holds in base b with Var X ≤ K 3 k and K 3 = 1 + 2 / ( ( b − 1 ) δ ) . Column 0 again has an arbitrary law.
Concentration and switches. Put R = max ( 2 , 4 K 3 ) . Since | E X − m | ≤ 2 ≤ R k / 2 for k ≥ 4 , Chebyshev’s inequality gives Pr ( | X − m | > R k ) ≤ 1 4 . Steps 4 and 5 of the proof of Theorem 10 use only the decomposition (6), the bound | W | ≥ c b ′ h , and k ≤ C b ′ h . Hence they apply unchanged, and Lemma 7 gives Pr p ( C b , k = m ∣ a 0 odd ) ≥ c b / k .
Conclusion. For large D,
T b ( D ) b D ≥ Pr ( A ′ ∩ U ′ ) c b 4 k − k 2 2 D − D − 1 ≥ c b ′ log D .
   □
Figure 11 shows exact counts in four bases. In base 2 the normalised density oscillates between about 0.09 and 0.14 , with peaks at D = 16 , 32 , 64 , 128 , where the typical digit sum D / 2 is just below a power of 2, and troughs at D = 24 , 48 , 96 . Theorems 13 and 15 together give a complete picture at the level of 2-cycles: in odd bases the dynamics is trivial, and in every even base the 2-cycles have density of exact order ( log D ) − 1 / 2 , with resonances located at the base-b repunits b j − 1 .

12. Convergence

We stress at the outset what is and is not proved. Every orbit computed so far is eventually periodic, but we do not prove that every orbit is eventually periodic (Conjecture 21). What we prove is an exact reformulation: eventual periodicity is equivalent to boundedness of the digit sums along the orbit (Theorem 16).
Lemma 12 
(Crossing lemma). If a term n < 10 J of an orbit is followed by f ( n ) ≥ 10 J , then n is odd and 10 J − n ≤ s ( n ) ; if moreover s ( n ) ≤ B < 10 t , the leading J − t digits of n are nines, so s ( n ) ≥ 9 ( J − t ) .
Proof. 
If n were even, f ( n ) = n − s ( n ) ≤ n < 10 J , a contradiction; so n is odd and f ( n ) = n + s ( n ) ≥ 10 J , i.e. 10 J − n ≤ s ( n ) . If s ( n ) ≤ B < 10 t (with t < J ), then 10 J − 10 t < 10 J − B ≤ n < 10 J . Every integer in the interval ( 10 J − 10 t , 10 J ) has exactly J digits, of which the leading J − t are nines, since 10 J − 10 t is the number formed by J − t nines followed by t zeros. Hence s ( n ) ≥ 9 ( J − t ) .    □
Theorem 16 
(Convergence criterion). The orbit of n is eventually periodic if and only if the digit sums of its terms are bounded. If they are bounded by B < 10 t , every term is below 10 J with J = max ( ⌈ log 10 ( n + 1 ) ⌉ , ⌊ B / 9 ⌋ + t + 1 ) .
Proof. 
Eventually periodic orbits are finite. Conversely, n < 10 J ; if a term reached 10 J , its predecessor m would satisfy s ( m ) ≥ 9 ( J − t ) ≥ 9 ( ⌊ B / 9 ⌋ + 1 ) > B by Lemma 12. So the orbit is bounded, hence eventually periodic.    □
Corollary 5 
(Anatomy of a divergent orbit). A divergent orbit contains, for infinitely many J, an odd term 10 J − x with 1 ≤ x ≤ s ( 10 J − x ) : a block of nines followed by a short tail. Its digit sums are unbounded.
Proposition 6 
(Ascents with small digit sum). Let 9 ∣ n 0 , n 0 odd, s ( n 0 ) even and s ( n 0 ) < 198 , and let n 0 < n 1 < … be the ascending run from n 0 , i.e. the consecutive odd terms n j + 1 = n j + s ( n j ) . Then the run is finite. Along it the digit sum never increases, except possibly at its last term, where it can exceed the previous digit sum by 9.
Proof. 
Every odd n j with s ( n j ) even is followed by the odd term n j + 1 = n j + s ( n j ) . If s ( n j ) is odd, then n j + s ( n j ) is even, so n j is the last term of the run. Suppose s ( n j ) = S is even, a multiple of 9, and 18 ≤ S ≤ 180 , so s ( S ) = 9 . By Lemma 1, s ( n j + 1 ) = S + 9 − 9 C with C = C ( n j , S ) ≥ 0 . If C is odd, s ( n j + 1 ) ≤ S is even and the run continues at a level that has not increased. If C is even, s ( n j + 1 ) is odd, so n j + 1 is the last term. Its digit sum is S + 9 if C = 0 and at most S − 9 otherwise.1 By induction, every term before the last has an even digit sum of at most s ( n 0 ) ≤ 180 , and the last term has digit sum at most s ( n 0 ) + 9 < 198 . The run is increasing with bounded digit sums, so it is finite by Lemma 12, as in the proof of Theorem 16.    □
The next theorem removes the restriction to small levels for runs along which the level does not change. It applies the carry-balance idea along an arithmetic progression: while the level is constant, an ascent adds the same number 9 k at every step, and the digits above the lowest ones then behave like a counter that must eventually pass a block of nines.
Theorem 17 
(Constant-level runs are short). Let 9 ∣ n 0 have level k ≥ 1 , let ℓ be the number of digits of 9 k and κ = κ ( k ) . Suppose n 0 , n 1 , … , n r are consecutive terms of an orbit that all have level k. Then
| n r − n 0 | < 2 · 10 ℓ + κ ≤ 2 · ( 90 k ) 2 .
Proof. 
If k is odd, each step adds or subtracts the odd number 9 k , so parity alternates. An odd term n j goes up to n j + 9 k , which is even, has level k and therefore returns to n j ; an even term likewise goes down and returns. So the run alternates between two values, and | n r − n 0 | ≤ 9 k < 2 · 10 ℓ .
If k is even, 9 k is even and every term has the parity of n 0 , so the run is either ascending ( n j + 1 = n j + 9 k , all n j odd) or descending ( n j + 1 = n j − 9 k , all even); consider an ascending run, the descending case being identical with borrows and zeros in place of carries and nines. By Theorem 3, every step produces exactly κ carries. Write n j = q j 10 ℓ + x j with 0 ≤ x j < 10 ℓ . Since 9 k < 10 ℓ , each step increases q by 0 or 1, and by 1 exactly when it carries out of column ℓ − 1 ; as x grows by 9 k on every step that does not increase q, q increases at least once in every ⌈ 10 ℓ / ( 9 k ) ⌉ consecutive steps.
Suppose q increases at least 10 κ times during the run. The values q 0 , q 0 + 1 , … , q 0 + 10 κ − 1 are then all taken, one of them, q * , ends in κ nines, and the step that raises q from q * to q * + 1 belongs to the run. That step carries out of column ℓ − 1 and then through the κ nines in columns ℓ , … , ℓ + κ − 1 , so it produces at least κ + 1 carries, a contradiction. Hence q increases at most 10 κ − 1 times, so r ≤ 10 κ ⌈ 10 ℓ / ( 9 k ) ⌉ and
n r − n 0 = 9 k r ≤ 9 k · 10 κ 10 ℓ 9 k + 1 = 10 ℓ + κ + 9 k · 10 κ < 2 · 10 ℓ + κ .
Finally κ ≤ ℓ (the digit sum of 9 k is at most 9 ℓ ) and 10 ℓ ≤ 90 k , so 10 ℓ + κ ≤ ( 90 k ) 2 .    □
The bound was checked on 228 maximal constant-level runs in orbits of random numbers with 30 to 480 digits: none came within 14 % of it. Since the level of a D-digit number is at most D, every constant-level run moves the orbit by O ( D 2 ) , a negligible amount compared with n.
  • What is missing for global convergence.
Theorem 17 does not by itself bound an ascent, i.e. a maximal stretch on the odd rail, because the level may change inside an ascent and stay even. For k ≤ 10 the only possible increase is to k + 1 , which leaves the rail, and this gives Proposition 6. For larger k, κ ( k ) ≥ 2 allows an increase by 2 that keeps the rail, and such increases do occur: among 448 ascents in orbits of random numbers with 50 to 800 digits we observed 14 level increases by 2 (and 244 by 1, at the end of an ascent). The heights of these ascents nevertheless grew only linearly with the number of digits (at most 39 , 240 for 800 digits). A proof of Conjecture 21 along these lines would need to show that level increases inside an ascent cannot accumulate, for example by controlling the level along the counter q above.

A computer-assisted proof for all starting values below explicit bounds

Prefix lifting turns Conjecture 21, restricted to a finite range, into a finite check, provided the blocks are large enough that a single constant-level run cannot cross one (Theorem 17). We state it for every even base b; recall that f b has the parity of the last digit.
Theorem 18 
(Block certificate). Let b be even, D > L ≥ 1 , M = b L , σ max = ( b − 1 ) ( D − L ) and E = σ max + ( b − 1 ) L + 1 , and assume σ max + ( b − 1 ) L < M . For 0 ≤ σ ≤ σ max let g σ ( x ) = x ± ( σ + s b ( x ) ) (plus for odd x, minus for even x) on [ 0 , M ) . Suppose that for every such σ no x < E is carried by iterating g σ to a value ≥ M . Then every orbit of f b starting at some n < b D stays below ( ⌊ n / M ⌋ + 2 ) M ; in particular it is bounded, hence eventually periodic, and max ( orbit ) − n < 2 M .
Proof. 
Write each term as H · M + x with 0 ≤ x < M . Since s b ( H M + x ) = s b ( H ) + s b ( x ) and H M + x ≡ x ( mod 2 ) , as long as H is unchanged the low part evolves by g s b ( H ) ; each step changes x by less than M (because s b ( H M + x ) ≤ σ max + ( b − 1 ) L < M whenever s b ( H ) ≤ σ max ), so H changes by at most 1 per step, upwards exactly when g s b ( H ) leaves [ 0 , M ) at the top. Right after such an upward step the new low part is x ′ = y + s b ( H M + y ) − M < s b ( H M + y ) ≤ σ max + ( b − 1 ) L < E .
Let H 0 = ⌊ n / M ⌋ < b D − L . Suppose some term had high part H 0 + 2 , and consider the first such term. Its predecessor has high part H 0 + 1 , and the maximal stretch of the orbit at high part H 0 + 1 that contains it began with an upward step from H 0 (it cannot have begun with a downward step from H 0 + 2 , which has not yet occurred, nor with n itself). So that stretch starts at a low part x ′ < E and leaves [ 0 , M ) at the top under g σ with σ = s b ( H 0 + 1 ) . As H 0 + 1 ≤ b D − L we have σ ≤ σ max , contradicting the hypothesis. Hence every term has high part at most H 0 + 1 , so the orbit is contained in [ 0 , ( H 0 + 2 ) M ) . A bounded orbit of a map on the integers is eventually periodic, and max ( orbit ) − n < ( H 0 + 2 ) M − H 0 M = 2 M .    □
The hypothesis is a finite computation: for each σ , the fate of every x ∈ [ 0 , M ) under g σ (absorbed at the top, absorbed at the bottom, or periodic) is determined exactly by iterating the functional graph 2 r ≥ M + 2 times with pointer doubling, in exact integer arithmetic.
Theorem 19 
(Eventual periodicity below explicit bounds). Every orbit of the binary map f 2 starting below 2 3024 , and every orbit of the decimal map f starting below 10 2224 , is eventually periodic. For these starting values, max ( orbit ) − n < 2 · 2 24 and max ( orbit ) − n < 2 · 10 8 , respectively.
Proof. 
The hypothesis of Theorem 18 was verified by computer for the parameters in Table 7. The last row of each base uses the climb method described below.    □
Climb method. The hypothesis of Theorem 18 only concerns the finite low maps, and g σ on [ 0 , b L ) agrees with the half-line map x ↦ x ± ( σ + s b ( x ) ) until the orbit leaves the block. It therefore suffices to follow each entry x 0 < E on the half-line, until it falls below 0 or closes a cycle, and to check that its maximum is below b L . Memoising the maximum over each orbit makes this cost roughly linear in the number of states actually visited, rather than b L . This removes the memory bottleneck of the block arrays. In base 10 with L = 8 , for every σ ≤ 19 , 944 and every entry below E = 20 , 017 , the highest point reached is 20 , 020 , 006 (at σ = 19 , 943 ), below 10 8 . In base 2 with L = 24 , for σ ≤ 3000 , it is 2 , 107 , 392 < 2 24 . These give the last two rows of Table 7. Figure 12 shows the maximum climb as a function of σ . It is not smooth: a slowly rising baseline carries sharp spikes when σ is just below a multiple of 1000, about 2 · 10 6 at even thousands, 10 7 near 10 4 and 2 · 10 7 near 2 · 10 4 . There the step σ + s ( x ) is just below a round number, and carries propagate through long blocks of nines: this is the resonance of Section 8, now acting on climbs. The next spike makes L = 8 insufficient. At σ = 19 , 961 an orbit reaches about 2 · 10 8 , so extending the range needs L = 9 . The reported range is therefore the largest this block size certifies, not an artefact of stopping early.
  • Verification protocol.
The proof consists of exactly two finite computations, the last two rows of Table 7. Their inputs are ( b , σ max , L ) = ( 10 , 19944 , 8 ) and ( 2 , 3000 , 24 ) , and their outputs are the highest points 20 , 020 , 006 < 10 8 and 2 , 107 , 392 < 2 24 . Every other computation in this section is a cross-check. These are the block method on small parameters, direct orbit enumeration, and the deliberately failing case ( 2 , 16 , 8 ) , which make implementation errors unlikely but prove nothing. The two proof computations are recomputed by a standalone checker, verify_certificates.py, under 100 lines that share no code with the rest of the package. It follows each entry x 0 < E until the orbit becomes negative or reaches a state already seen. Because the highest point of a forward orbit depends only on its starting state, storing it for every state visited (memoisation) is exact. If the program finishes, every orbit has been followed completely. It reproduces all 19 , 945 per- σ maxima of Figure 12 exactly, and reports failure on ( 2 , 16 , 8 ) . The archived release lists SHA-256 hashes of the checker, the certificate outputs and the manuscript source.
Figure 12. Maximum climb of the low maps g σ from all entries x 0 < E = 20 , 017 , against σ (base 10, L = 8 ). Every value lies below the block size 10 8 , which proves Theorem 19 for all n < 10 2224 . Spikes occur just below multiples of 1000, where the step is close to a round number.
Figure 12. Maximum climb of the low maps g σ from all entries x 0 < E = 20 , 017 , against σ (base 10, L = 8 ). Every value lies below the block size 10 8 , which proves Theorem 19 for all n < 10 2224 . Spikes occur just below multiples of 1000, where the step is close to a round number.
Preprints 242433 g012
On the six small parameter sets used below, the climb method and the block method give identical verdicts, including the failure at ( 2 , 16 , 8 ) .
These ranges exceed exhaustive enumeration ( n ≤ 2 · 10 6 ) by a factor of about 10 2218 in base 10. Two checks guard against errors in the implementation. First, for small parameters ( ( b , D , L ) = ( 2 , 18 , 9 ) , ( 4 , 8 , 5 ) , ( 10 , 5 , 3 ) , ( 10 , 6 , 4 ) ) every orbit starting below b D was followed directly, and its high part never exceeded H 0 + 1 , as the theorem asserts. Second, the certificate is not vacuous: for ( b , D , L ) = ( 2 , 16 , 8 ) it fails, and direct computation shows that some orbit below 2 16 does climb two blocks.
The block size needed grows only logarithmically: L = 2 log 2 D + 4 in base 2 for D = 64 , 128 , 256 , 512 , and L = 5 , 6 , 7 for D = 12 , 20 , 30 in base 10. The following lemma explains why a check at one scale controls larger scales. Write Bad L ( σ ; W ) if some x < W reaches the top exit of [ 0 , b L ) under g σ .
Lemma 13 
(Scale reduction). Let L > L ′ ≥ 1 , b even, and σ + ( b − 1 ) L ≤ W ≤ b L ′ . If Bad L ( σ ; W ) , then Bad L ′ ( σ + j ; W ) for every j ∈ { 0 , 1 , … , ( b − 1 ) ( L − L ′ ) } .
Proof. 
Write x = h b L ′ + y with 0 ≤ y < b L ′ . Then s b ( x ) = s b ( h ) + s b ( y ) and x ≡ y ( mod 2 ) , so while h is fixed the orbit of g σ follows g σ + s b ( h ) on [ 0 , b L ′ ) . Every step is at most σ + ( b − 1 ) L < b L ′ , so h changes by ± 1 at a time. An orbit starting at x < W ≤ b L ′ (so h = 0 ) and leaving [ 0 , b L ) at the top must cross from h to h + 1 for every h < b L − L ′ . Fix such an h and consider the last entry into sub-block h before the first crossing to h + 1 . For h = 0 it is the start y = x < W . For h ≥ 1 it comes from h − 1 , since h + 1 has not been visited, and the entry point satisfies y < step ≤ σ + ( b − 1 ) L ≤ W . From y the map g σ + s b ( h ) carries the orbit to the top of the sub-block, so Bad L ′ ( σ + s b ( h ) ; W ) . As h ranges over [ 0 , b L − L ′ ) , s b ( h ) takes every value in { 0 , … , ( b − 1 ) ( L − L ′ ) } .    □
So the bad set at scale L is contained in the set of σ whose whole window [ σ , σ + ( b − 1 ) ( L − L ′ ) ] is bad at scale L ′ . A single good parameter at a small scale therefore certifies ( b − 1 ) ( L − L ′ ) + 1 parameters at every larger scale. Numerically, though, the bad set at a fixed scale is not sparse. Once σ exceeds roughly b L / 2 , almost every σ is bad, so the lemma speeds up the computation but does not by itself give a proof.
The quantity that governs the problem is L min ( σ ) , the least L with no x < σ + ( b − 1 ) L + 1 exiting at the top. Every σ ≤ θ L satisfies L min ( σ ) ≤ L , where
b 10 10 10 10 2 2 2 2 2 L 3 4 5 6 10 12 14 16 18 θ L 69 179 963 1952 54 113 244 495 1010 b L / θ L 2 0.21 0.31 0.11 0.26 0.35 0.32 0.28 0.27 0.26
In both bases the block needed is quadratic in σ , with b L min ≈ σ 2 / 4 . This is the order of the height 2 b ℓ + κ ≤ 2 ( ( b − 1 ) b k ) 2 of a constant-level run in Theorem 17. It suggests that climbs from the bottom are no higher than single constant-level runs, so the level changes inside an ascent do not compound. Conjecture 21 would follow from the uniform quantitative strengthening below.
For the statement we use the half-line map g ¯ σ ( x ) = x + σ + s b ( x ) (x odd), x − σ − s b ( x ) (x even), on Z ≥ 0 , with orbits stopped when they become negative. It does not involve a block length; g σ on [ 0 , b L ) agrees with it until the orbit leaves the block.
Conjecture 20 
(Quadratic climbs). There is an absolute constant c such that for every even b, every σ ≥ 0 and every X ≥ 0 , every orbit of g ¯ σ that starts at some x 0 ≤ X stays below c ( σ + X + 1 ) 2 .
Conjecture 20 is a strengthening of Conjecture 21, not a reduction of it. Since g ¯ 0 = f , the case σ = 0 already says that every orbit of f starting at x 0 ≤ X stays below c ( X + 1 ) 2 , a quantitative form of Conjecture 21. What the conjecture adds is uniformity in σ , which is the form the block certificate needs. That it implies Conjecture 21 can be seen directly, or through Theorem 18, as follows. Given D, choose L minimal with b L > c ( 2 ( b − 1 ) D + 1 ) 2 , so L = O ( log D ) , and apply Theorem 18. Its hypothesis concerns σ ≤ σ max = ( b − 1 ) ( D − L ) and entries x 0 < E = σ max + ( b − 1 ) L + 1 . With X = E the conjecture bounds every such orbit by c ( σ max + E + 1 ) 2 ≤ c ( 2 ( b − 1 ) D + 1 ) 2 < b L , so no orbit reaches the top of the block. The data of Theorem 19 are consistent with c = 1 : for σ ≤ 19 , 944 and X = E the highest point is 20 , 020 , 006 < ( 19 , 944 + 20 , 017 ) 2 in base 10, and for σ ≤ 3000 it is 2 , 107 , 392 < ( 3000 + 3025 ) 2 in base 2. For 10 ≤ σ ≤ 3000 and all entries x ≤ σ + ( b − 1 ) · 8 (base 10) or x ≤ σ + 24 (base 2), about 4.7 million starting points in each base, the highest point is below 1.71 ( σ + 1 ) 2 in base 10 and 1.19 ( σ + 1 ) 2 in base 2. The number of separate up-runs in a climb is not bounded, however. It reaches 19 in base 10 and 61 in base 2, with up to 33 and 61 level changes. So a proof cannot simply count runs: it must show that successive runs do not stack. The conjecture concerns only the maps g ¯ σ , with no dynamics of the prefix. Theorem 17 proves it for runs at constant level. What remains is to control level increases inside an ascent, which we do not know how to do.
The structure above explains convergence heuristically: regular steps are translations that Theorem 4 pairs into ascents and mirrored descents, so net drift can only come from exceptional carries, which require long blocks of nines. Numerically, every orbit from n ≤ 2 · 10 6 is eventually periodic, the largest excursion max ( orbit ) − n there is 777 (at n = 998457 ), and for 300 random starts (Python random.Random(0)) with each of 10 , … , 400 digits the excursion grows roughly linearly in the number of digits (Figure 13).
Conjecture 21. 
Every orbit of f is eventually periodic; equivalently, digit sums are bounded along every orbit.
Remark 4. 
Theorem 6 suggests a computer-assisted proof for n < 10 D : track the low map g σ and show that the prefix cannot climb indefinitely. A coarse version (after the prefix increases it cannot increase again before decreasing) fails for sparse clusters of σ; a finer version tracking the last digits of H and the side from which each level is entered remains to be carried out.

13. Cycle Statistics

Two different quantities are easy to confuse here: the number of distinct cycles of a given length, and the proportion of starting values whose orbit enters a cycle of that length. They can differ substantially, because basins have very different sizes. Table 9 and Figure 15 give both.
Table 8 counts the distinct cycles reached from multiples of 9 up to N (each cycle counted once, regardless of the point at which it is entered) and the number of steps before the orbit enters its cycle.
Table 8. Orbits of the multiples of 9 up to N: number of distinct cycles reached, and statistics of the number of steps before entering the cycle (exact enumeration).
Table 8. Orbits of the multiples of 9 up to N: number of distinct cycles reached, and statistics of the number of steps before entering the cycle (exact enumeration).
N distinct cycles mean steps std. steps max steps
500 20 0.47 0.78 3
1,000 26 1.95 2.97 13
10,000 171 1.35 1.70 13
100,000 2,037 1.16 1.44 13
200,000 4,149 1.16 1.51 27
Table 9 and Figure 14 list the cycles found. The statement in the introduction that 2-cycles dominate refers to the number of distinct cycles; by basin size they account for about seven-tenths of all starting values. Odd lengths occur; which lengths are possible, and how the turns produce them, is not yet classified. In the 15-cycle the ascent adds 18 six times and 27 once and the descent subtracts 18 seven times and 9 once, both totalling 135.
Table 9. Cycles other than the fixed point { 0 } reached from 1 ≤ n ≤ 2 · 10 6 : number of distinct cycles, their share of all 43 , 210 cycles, the share of starting values n whose orbit enters a cycle of that length (only the six starts 1 , 2 , 3 , 4 , 6 , 8 reach { 0 } ), and the cycle of smallest minimum for each length.
Table 9. Cycles other than the fixed point { 0 } reached from 1 ≤ n ≤ 2 · 10 6 : number of distinct cycles, their share of all 43 , 210 cycles, the share of starting values n whose orbit enters a cycle of that length (only the six starts 1 , 2 , 3 , 4 , 6 , 8 reach { 0 } ), and the cycle of smallest minimum for each length.
length #cycles % of cycles % of starts smallest example
2 37374 86.5 72.3 9 , 18
3 81 0.19 0.70 8991 , 9018 , 9000
4 4759 11.0 20.7 2871 , 2889 , 2916 , 2898
5 72 0.17 0.57 289953 , 289989 , 290034 , 290016 , 289998
8 605 1.40 2.64 89793 , 89829 , … , 89820
14 17 0.04 0.20 89991 , 90027 , … , 90000
15 284 0.66 2.79 1791 , 1809 , … , 1899 , 1926 , … , 1800
16 18 0.04 0.16 189783 , 189819 , … , 189810
Figure 14. Distribution of cycle lengths (logarithmic scale).
Figure 14. Distribution of cycle lengths (logarithmic scale).
Preprints 242433 g014
Figure 15. Share of distinct cycles (blue) and of starting values (orange) by cycle length, for 1 ≤ n ≤ 2 · 10 6 . The 2-cycles are 86.5 % of the cycles but attract only 72.3 % of the starts; 4-, 8- and 15-cycles have larger basins than their numbers suggest.
Figure 15. Share of distinct cycles (blue) and of starting values (orange) by cycle length, for 1 ≤ n ≤ 2 · 10 6 . The 2-cycles are 86.5 % of the cycles but attract only 72.3 % of the starts; 4-, 8- and 15-cycles have larger basins than their numbers suggest.
Preprints 242433 g015

14. Open Problems

  • Prove Conjecture 21. It is proved below 10 2224 (Theorem 19); by Theorem 18 the general case would follow from the absence of upward crossings for the finite maps g σ with blocks of size b O ( log σ ) . By Theorem 17 it would also suffice to show that level increases inside an ascent cannot accumulate. The same question can be asked in every even base; base 2, where the digit sum is the number of ones, may be the most tractable case.
  • Corollary 4 determines the limit points of the normalised 2-cycle density. Extend the oscillation law to every even base; the analogue of Lemma 8 holds with 10 replaced by b, and the extremal problem of Lemma 9 changes with b.
  • Do all cycles, not only 2-cycles, have density zero? In the census, 2-cycles are about 86 % of all distinct cycles, but points on longer cycles are not rare. Exhaustively, 5.0 % , 5.2 % and 5.2 % of n ≤ N are periodic for N = 10 5 , 10 6 , 10 7 , and the share of them on 2-cycles falls from 73 % to 60 % . Sampling 40 , 000 random D-digit numbers gives periodic proportions of 5.7 % , 4.5 % , 4.9 % , 4.4 % , 5.0 % , 4.3 % and 4.2 % (standard error 0.1 % ) for D = 8 , 16 , … , 512 , with 4-cycles about as frequent as 2-cycles and apparently oscillating with D. The data therefore neither confirm nor refute density zero. The natural conjecture is that the periodic proportion is of order ( log D ) − 1 / 2 , like that of 2-cycles, which would make the decay invisible at these sizes. For a 4-cycle a → b → c → d → a with two ascending and two descending steps, closure means s ( a ) + s ( b ) = s ( c ) + s ( d ) ; by Lemma 1 this is a linear condition on three carry and borrow counts, C ( a , s ( a ) ) , C ( b , s ( b ) ) and B ( c , s ( c ) ) , which depend on overlapping low digits. The switch argument of Lemma 3 handles one such count; a proof for 4-cycles needs a joint anti-concentration bound for these coupled counts.
  • Determine the profile c L ( σ ) analytically, and classify the possible cycle lengths.
  • Explain the rare cycles with two ascending runs.

Data Availability Statement

All computations are reproducible with the accompanying Python package (digitdyn), available at https://github.com/rudraneel93/Digital-Root (directory digitdyn) and archived on Zenodo as release v1.0.2, doi:10.5281/zenodo.23940129 [21]. It contains: the exhaustive orbit and cycle census (Proposition 2, Table 9 and Table 8); the digit dynamic programme for T ( D ) (Table 3), tested against exhaustive enumeration for D ≤ 5 ; the prefix-lifting counter (Theorem 6, Corollary 1); the carry-resonance computation (Theorem 8); exact checks of Theorems 2, 3, 4 and 9; the block and climb certificates of Theorem 19, with their outputs; the exact carry-variance and oscillation-law computations (Section 10.1); the basin census (Table 9); a test suite of 59 tests; a single script that regenerates every table and figure; and SHA-256 hashes of the released sources and certificate outputs. All computations were run on an Apple M1 laptop with 8 GB of memory, using Python 3.11.9, NumPy 1.26.4 and Matplotlib 3.10.6. The certificate for 2 3024 takes under a minute, and the one for 10 2224 about two minutes on 8 cores; the slowest step of the full reproduction is the oscillation table (Table 4), which evaluates the main term up to D ≈ 6 · 10 7 . Throughout the paper we distinguish theorems (proved), computational statements (exact computations over a stated finite range) and conjectures.

References

  1. P. Diaconis and D. Freedman, Finite exchangeable sequences, Ann. Probab. 8 (1980), 745–764. [CrossRef]
  2. M. Mitzenmacher and E. Upfal, Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Cambridge University Press, 2005.
  3. W. Hoeffding, Probability inequalities for sums of bounded random variables, J. Amer. Statist. Assoc. 58 (1963), 13–30. [CrossRef]
  4. N. L. Bassily and I. Kátai, Distribution of the values of q-additive functions on polynomial sequences, Acta Math. Hungar. 68 (1995), 353–361. [CrossRef]
  5. D. Dolgopyat and O. M. Sarig, Local Limit Theorems for Inhomogeneous Markov Chains, Lecture Notes in Mathematics 2331, Springer, 2023.
  6. M. Drmota and J. Gajdosik, The distribution of the sum-of-digits function, J. Théor. Nombres Bordeaux 10 (1998), 17–32. [CrossRef]
  7. C. Mauduit and J. Rivat, Sur un problème de Gelfond: la somme des chiffres des nombres premiers, Ann. of Math. 171 (2010), 1591–1646. [CrossRef]
  8. R. L. Dobrushin, Central limit theorem for nonstationary Markov chains I, II, Theory Probab. Appl. 1 (1956), 65–80 and 329–383. [CrossRef]
  9. S. Sethuraman and S. R. S. Varadhan, A martingale proof of Dobrushin’s theorem for non-homogeneous Markov chains, Electron. J. Probab. 10 (2005), 1221–1235. [CrossRef]
  10. S. G. Hoggar, Chromatic polynomials and logarithmic concavity, J. Combin. Theory Ser. B 16 (1974), 248–254. [CrossRef]
  11. V. V. Petrov, Sums of Independent Random Variables, Springer, 1975.
  12. B. A. Rogozin, On the increase of dispersion of sums of independent random variables, Theory Probab. Appl. 6 (1961), 97–99. [CrossRef]
  13. A. Borodin, P. Diaconis and J. Fulman, On adding a list of numbers (and other one-dependent determinantal processes), Bull. Amer. Math. Soc. 47 (2010), 639–670. [CrossRef]
  14. P. Diaconis, X. Shao and K. Soundararajan, Carries, group theory, and additive combinatorics, Amer. Math. Monthly 121 (2014), 674–688. [CrossRef]
  15. P. Diaconis and J. Fulman, Carries, shuffling, and symmetric functions, Adv. in Appl. Math. 43 (2009), 176–196. [CrossRef]
  16. J. M. Holte, Carries, combinatorics, and an amazing matrix, Amer. Math. Monthly 104 (1997), 138–149. [CrossRef]
  17. D. R. Kaprekar, The Mathematics of New Self-Numbers, Devlali, 1963.
  18. E. E. Kummer, Über die Ergänzungssätze zu den allgemeinen Reciprocitätsgesetzen, J. Reine Angew. Math. 44 (1852), 93–146. [CrossRef]
  19. J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly 92 (1985), 3–23.
  20. OEIS Foundation, Sequence A003052 (self numbers), https://oeis.org/A003052.
  21. R. Das, digitdyn: code and data for “Carries, Rails and Resonance”, version v1.0.2, Zenodo (2026). [CrossRef]
  22. E. Angelini, Sequence A124176, The On-Line Encyclopedia of Integer Sequences (2006), https://oeis.org/A124176.
  23. E. Angelini, Sequence A124177, The On-Line Encyclopedia of Integer Sequences (2006), https://oeis.org/A124177.
  24. OEIS Foundation, Sequence A243260, https://oeis.org/A243260.
  25. OEIS Foundation, Sequence A004207, https://oeis.org/A004207.
1
For example 8901 → 8919 : s = 18 → 27 , after which f ( 8919 ) = 8946 is even and 8919 ↔ 8946 is a 2-cycle.
Figure 1. The 15-cycle through 1791. Odd terms (circles) ascend by 18 (once by 27); even terms (squares) descend by 18 (once by 9). Here the descent is the ascent run backwards and shifted by + 9 , as predicted by the conditional reversibility identity (Theorem 4).
Figure 1. The 15-cycle through 1791. Odd terms (circles) ascend by 18 (once by 27); even terms (squares) descend by 18 (once by 9). Here the descent is the ascent run backwards and shifted by + 9 , as predicted by the conditional reversibility identity (Theorem 4).
Preprints 242433 g001
Figure 2. Dependencies between the main results. Boxes with heavier frames are the principal theorems.
Figure 2. Dependencies between the main results. Boxes with heavier frames are the principal theorems.
Preprints 242433 g002
Figure 3. Rails and turns. Regular steps translate along a rail; the shift τ maps the odd rail to the even rail and reverses time (Theorem 4), so the descent retraces the ascent.
Figure 3. Rails and turns. Regular steps translate along a rail; the shift τ maps the odd rail to the even rail and reverses time (Theorem 4), so the descent retraces the ascent.
Preprints 242433 g003
Figure 5. Number of 2-cycles of the low map g σ for L = 5 (thin) and an 18-term moving average (thick). Peaks occur where the typical digit sum s ( n ) ≈ σ + 22 ends in a run of nines.
Figure 5. Number of 2-cycles of the low map g σ for L = 5 (thin) and an 18-term moving average (thick). Peaks occur where the typical digit sum s ( n ) ≈ σ + 22 ends in a run of nines.
Preprints 242433 g005
Figure 6. ρ ( t ) for odd multiples t of 9. The maximum 9 / 10 is attained at t = 10 j − 1 (Proposition 4).
Figure 6. ρ ( t ) for odd multiples t of 9. The maximum 9 / 10 is attained at t = 10 j − 1 (Proposition 4).
Preprints 242433 g006
Figure 7. Density of 2-cycles below 10 D : exact values (dots) and the resonance approximation (line), with 4.5 D = 99 , 999 , 9999 marked.
Figure 7. Density of 2-cycles below 10 D : exact values (dots) and the resonance approximation (line), with 4.5 D = 99 , 999 , 9999 marked.
Preprints 242433 g007
Figure 8. Exact distribution of the number of carries in a + t for a typical t = 4536271809123471 ( s ( t ) = 63 ), with a random and odd. The 2-cycle condition requires 7 = s ( t ) / 9 carries, next to the mean 64 / 9 ≈ 7.111 (Theorem 9); it holds with probability 0.206 .
Figure 8. Exact distribution of the number of carries in a + t for a typical t = 4536271809123471 ( s ( t ) = 63 ), with a random and odd. The 2-cycle condition requires 7 = s ( t ) / 9 carries, next to the mean 64 / 9 ≈ 7.111 (Theorem 9); it holds with probability 0.206 .
Preprints 242433 g008
Figure 11. Exact normalised 2-cycle densities ln D T b ( D ) / b D (each divided by its mean) in bases 2 , 4 , 6 , 10 , plotted against log b of the typical digit sum ( b − 1 ) D / 2 . In every base the peaks lie near integers, where the typical digit sum is close to b j − 1 (Proposition 5).
Figure 11. Exact normalised 2-cycle densities ln D T b ( D ) / b D (each divided by its mean) in bases 2 , 4 , 6 , 10 , plotted against log b of the typical digit sum ( b − 1 ) D / 2 . In every base the peaks lie near integers, where the typical digit sum is close to b j − 1 (Proposition 5).
Preprints 242433 g011
Figure 13. Largest excursion over 300 random starting values for each number of digits.
Figure 13. Largest excursion over 300 random starting values for each number of digits.
Preprints 242433 g013
Table 1. Neighbouring digit maps. In A124176/A124177 “odd digits” are digits with odd value, not digits in odd positions.
Table 1. Neighbouring digit maps. In A124176/A124177 “odd digits” are digits with odd value, not digits in odd positions.
map rule what is recorded
digital river [25] n ↦ n + s ( n ) orbits, self numbers [20]
A124176 [22] m ↦ m + ( sum of odd digits ) − ( sum of even digits ) periodic points
A124177 [23] m ↦ m + ( sum of even digits ) − ( sum of odd digits ) periodic points
A243260 [24] n ↦ n ± s ( n ) , sign by the parity of s ( n ) numbers that recur
this paper n ↦ n ± s ( n ) , sign by the parity of n structure, densities, convergence
Table 2. Notation.
Table 2. Notation.
symbol meaning
s ( n ) , s b ( n ) digit sum of n in base 10, base b
f, f b the digit-sum parity map (1) and its base-b analogue
C ( a , b ) , B ( a , b ) number of carries in a + b , of borrows in a − b
C K ( a , t ) carries out of columns 0 , … , K − 1 only
k, level s ( n ) = 9 k for a multiple of 9; κ ( m ) = s ( 9 m ) / 9
T ( D ) number of odd a < 10 D lying on a 2-cycle
P D ( t ) probability that D uniform digits sum to t
ρ ( t ) probability that adding t to a random odd number gives exactly s ( t ) / 9 carries
S ( t ) , W switch positions of t (Lemma 3) and the random set of active switches
q i , φ q i = Pr ( carry into column i ) ; φ ( x ) = x ( 1 − x ) (Section 10.1)
h, B D , K 0 scales and constants of the oscillation law (Theorem 12)
H, L, σ prefix and block length in n = H 10 L + x ; σ = s ( H )
g σ , g ¯ σ low map on [ 0 , b L ) and on the half-line (Section 12)
c L ( σ ) number of cycles of g σ confined to one block (Section 7)
Table 4. Local maxima and minima of log 10 D · 1 2 ∑ t P D ( t ) ρ ( t ) , the normalisation of Corollary 4, whose limits are K 0 6 ≈ 0.0347 and K 0 726 / 301 ≈ 0.0220 (computational; the extrema were located by a search over a grid of D near ( 10 j − 1 ) / 4.5 and 2.5 · 10 j / 4.5 ).
Table 4. Local maxima and minima of log 10 D · 1 2 ∑ t P D ( t ) ρ ( t ) , the normalisation of Corollary 4, whose limits are K 0 6 ≈ 0.0347 and K 0 726 / 301 ≈ 0.0220 (computational; the extrema were located by a search over a grid of D near ( 10 j − 1 ) / 4.5 and 2.5 · 10 j / 4.5 ).
j peak at D normalised peak trough at D normalised trough ratio
3 222 0.02482 777 0.01781 1.394
4 2,222 0.02720 7,777 0.01942 1.401
5 22,222 0.02753 38,888 0.02001 1.375
6 222,222 0.02891 614,035 0.02072 1.395
7 2,222,222 0.02904 6,345,029 0.02082 1.394
8 22,222,222 0.02995 63,450,292 0.02120 1.413
Table 6. Error budget for Theorem 12, with ε D = ( log D ) − 1 / 8 . Absolute errors are o ( ( log D ) − 1 / 2 ) ; relative errors multiply the main term by 1 + o ( 1 ) .
Table 6. Error budget for Theorem 12, with ε D = ( log D ) − 1 / 8 . Absolute errors are o ( ( log D ) − 1 / 2 ) ; relative errors multiply the main term by 1 + o ( 1 ) .
component what is shown error
resonance approximation T ( D ) / 10 D = 1 2 ∑ t P D ( t ) ρ ( t ) + error (Theorem 8) O ( ( log D ) 2 / D )
bad digit sums (G1) fails, or (G2) fails, or (G3) fails e − c log 2 D + O ( 1 / log D ) + O ( ( log D ) − 3 / 4 )
variance of good t V ( t ) = 11 9 ( h 6 + B D ) ( 1 + o ( 1 ) ) relative O ( ε D + log log D / log D )
local limit ρ ( t ) = ( 1 + o ( 1 ) ) ( 2 π V ( t ) ) − 1 / 2 (Theorem 11) relative o ( 1 ) , uniform in good t
mass of good t 1 2 P D ( good ) = 1 36 + o ( 1 ) (Lemma 5) O ( 1 / log D )
Table 7. Parameters for which the block certificate (Theorem 18) was verified, with running times on a laptop. Rows marked * use the climb method: every orbit is followed on the half-line and its maximum is compared with b L . †On 8 cores.
Table 7. Parameters for which the block certificate (Theorem 18) was verified, with running times on a laptop. Rows marked * use the climb method: every orbit is followed on the half-line and its maximum is compared with b L . †On 8 cores.
base b all n < block b L σ max entries checked E time
2 2 64 2 16 48 65 1 s
2 2 128 2 18 110 129 3 s
2 2 256 2 20 236 257 28 s
2 2 512 2 22 490 513 4 min
10 10 12 10 5 63 109 1 s
10 10 20 10 6 126 181 14 s
10 10 30 10 7 207 271 3.5  min
2 2 3024 2 24 3000 3025 30 s*
10 10 2224 10 8 19944 20017 2 min*†
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.