Running Modulus Recursions

Bruce Dearden and Jerry Metzger University of North Dakota Department of Mathematics Witmer Hall Room 313 101 Cornell Street Stop 8376 Grand Forks ND 58202-8376 USA

                     bruce.dearden@und.edu
                     jerry.metzger@und.edu

Abstract

Fix integers b ≥ 2 and k ≥ 1. Define the sequence {z_{n}} recursively by taking z_{0} to be any integer, and for n ≥ 1, take z_{n} to be the least nonnegative residue of bz_{n−1} modulo (n + k). Since the modulus increases by 1 when stepping from one term to the next, such a definition will be called a running modulus recursion or rumor for short. While the terms of such sequences appear to bounce around irregularly, empirical evidence suggests the terms will eventually be zero. We prove this is so when one additional assumption is made, and we conjecture that this additional condition is always met.

1 Introduction

Fix integers b ≥ 2 and k ≥ 1. Define the sequence {z_{n}} recursively by taking z_{0} to be any integer, and for n ≥ 1, z_{n} = bz_{n−1} mod (n + k), the least nonnegative residue of bz_{n−1} modulo (n + k). Since the modulus increases by 1 when stepping from one term to the next, a sequence generated in this fashion will be called running modulus recursion or rumor for short.

Since only the eventual behavior of rumors is of interest, we may as well assume 0 ≤ z_{0} ≤ k: using the same b parameter, the sequence with z′_{0} = z_{0} mod (k + 1), and, for n ≥ 1, z′_{n} = bz′_{n−1} mod (n + k), differs from the original sequence only in the first term.

The terms of such sequences appear to bounce around irregularly, at least for a while, but empirical evidence suggests that eventually a 0 term will occur in the sequence, and of course, if 0 occurs in the sequence, all following terms will also be 0.

For example, with z_{0} = 1, and for n ≥ 1, z_{n} = 3z_{n−1} mod (n + 11), the sequence begins

1, 3, 9, 13, 9, 11, 16, 12, 17, 11, 12, 14, 19, 9, 2, 6, 18, 26, 20, 0, ….

For this example, z_{19} is the first 0 term.

While there are many tantalizing patterns, the location of the first 0 does not seem to obey any simple general rule. For example, for k ≥ 1, let s_{b,k} denote the index of the first 0 in the rumor defined by z_{0} = 1, and z_{n} = bz_{n−1} mod (n + k). The sequence {s_{2,k}} begins

1, 2, 5, 10, 3, 18, 7, 24, 23, 22, 13, 4, 19, 18, 9, 6, 15, 374, 13, 12, 11, 370, 369, ….

This erratic behavior continues, as evidenced by the few additional values given in the tables below.

z_{0} b k first 0 term, s_{2,k}
1 2 68  324
1 2 69  12161
1 2 70  322
1 2 71  25

z_{0} b k first 0 term, s_{3,k}
1 3 68  784
1 3 69  783
1 3 70  782
1 3 71  10

2 Eventual Behavior: Condition and Conjecture

We show that the initial value z_{0} of a rumor may be naturally written in terms of a series expansion related to the base-b expansion of a related real number ζ_{0}. Under the additional condition that ζ_{0} is rational we show that the rumor is eventually zero. First we establish the natural expansion of z_{0} relative to the base-b and basic properties of its coefficients.

Lemma 1. Let b ≥ 2 and k ≥ 1. Suppose z_{0} is any integer and, for n ≥ 1, let z_{n} = bz_{n−1} mod (n + k). For n ≥ 1, let d_{n} = ⌊\frac{bz_{n−1}}{n+k} ⌋ so that z_{n} = bz_{n−1} − d_{n}(n + k). Then

(a) ∑_{n≥1} \frac{d_{n}(n + k)}{b^{n}} = z_{0},

(b) For n ≥ 2, 0 ≤ d_{n} ≤ b − 1,

(c) d_{n} < b − 1 infinitely often,

(d) z_{n} is eventually 0 iff d_{n} is eventually 0.

Proof. (a) Since

\frac{z_{n−1}}{b^{n−1}} − \frac{z_{n}}{b^{n}} = \frac{d_{n}(n + k)}{b^{n}},

we have the telescoping sum

∑_{1≤n≤j} \frac{d_{n}(n + k)}{b^{n}} = \frac{z_{0}}{b^{0}} − \frac{z_{j}}{b^{j}} .

The last term on the right goes to 0 as j → ∞ since 0 ≤ z_{j} < (j + k) and b ≥ 2. (b) For n ≥ 2, 0 ≤ z_{n−1} < n − 1 + k, and so

0 ≤ d_{n} = ⌊\frac{bz_{n−1}}{n + k} ⌋ ≤ \frac{bz_{n−1}}{n + k} ≤ \frac{b(n + k) − b}{n + k} = b − \frac{b}{n + k} < b.

(c) Suppose d_{n} = b − 1 for all n ≥ n_{0} for some n_{0}. Then, since z_{n−1} < n + k − 1,

z_{n} = bz_{n−1} − (b − 1)(n + k) < bz_{n−1} − (b − 1)z_{n−1} = z_{n−1}.

So {z_{n}} would be an eventually strictly decreasing sequence of nonnegative integers. (d) Suppose d_{n} is eventually 0. Then for large enough n,

z_{n} = bz_{n−1} − 0(n + k) = bz_{n−1},

which means z_{n} grows like a constant times b^{n}. Since z_{n} < n+k, that implies z_{n} is eventually 0. The converse is obvious.

We now turn to the main result of this note.

Theorem 2. Let b ≥ 2 and k ≥ 1 be integers. Let {z_{n}} be the integer sequence with initial term z_{0}, and for n ≥ 1, z_{n} = bz_{n−1} mod (n + k), the least nonnegative residue of bz_{n−1}

modulo (n + k). Let d_{n} = ⌊\frac{bz_{n−1}}{n+k} ⌋. If ζ_{0} = ∑_{n≥1} \frac{d_{n}}{b^{n}} is rational, then z_{n} is eventually zero.

Proof. Suppose {z_{n}} and {d_{n}} are constructed as described in the statement of the theorem.

Notice that for any m ≥ 0, we can generate the tail {z_{n}}_{n≥m} of the sequence {z_{n}} as a rumor. To do that we set z′_{0} = z_{m}, and, for n ≥ 1, let z′_{n} = bz′_{n−1} mod (n + k + m). Refer to this operation as restarting the sequence {z_{n}} (at m).

Now suppose w = ∑_{n≥1} \frac{d_{n}}{b^{n}} is rational. Since, by Lemma 1(b), 0 ≤ d_{n} ≤ b − 1 for n ≥ 2,

we can, after restarting \{z_{n}\} at 2 if necessary, view ∑_{n≥1} \frac{d_{n}}{b^{n}} as the base-b expansion of w.

Because w is rational, that expansion will be eventually periodic. Again, restarting {z_{n}} at some index if necessary, we may as well assume that expansion of w is purely periodic. Let p be the minimal period length of that expansion.

From Lemma 1(a) we see

z_{0} = ∑_{m≥1} \frac{d_{m}(m + k)}{b^{m}} = ∑_{j≥0} ∑_{1≤n≤p} \frac{d_{pj+n}(pj + n + k)}{b^{pj+n}}

= ∑_{1≤n≤p} ∑_{j≥0} \frac{d_{pj+n}(pj + n + k)}{b^{pj+n}}

= ∑_{1≤n≤p} (\frac{d_{n}p}{b^{n}} ∑_{j≥0} \frac{j}{(b^{p})^{j}} + \frac{nd_{n}}{b^{n}} ∑_{j≥0} \frac{1}{(b^{p})^{j}} + \frac{kd_{n}}{b^{n}} ∑_{j≥0} \frac{1}{(b^{p})^{j}} )

= ∑_{1≤n≤p} (\frac{d_{n}p}{b^{n}} \frac{\frac{1}{b^{p}}}{(1 − \frac{1}{b^{p}})^{2}} + \frac{nd_{n}}{b^{n}} \frac{1}{1 − \frac{1}{b^{p}}} + \frac{kd_{n}}{b^{n}} \frac{1}{1 − \frac{1}{b^{p}}} )

= ∑_{1≤n≤p} (\frac{d_{n}p}{b^{n}} \frac{b^{p}}{(b^{p} − 1)^{2}} + \frac{nd_{n}}{b^{n}} \frac{b^{p}}{b^{p} − 1} + \frac{kd_{n}}{b^{n}} \frac{b^{p}}{b^{p} − 1})

= \frac{pb^{p}}{(b^{p} − 1)^{2}} ∑_{1≤n≤p} \frac{d_{n}}{b^{n}} + \frac{b^{p}}{b^{p} − 1} ∑_{1≤n≤p} \frac{nd_{n}}{b^{n}} + \frac{kb^{p}}{b^{p} − 1} ∑_{1≤n≤p} \frac{d_{n}}{b^{n}} .

Multiplying both sides of

z_{0} = \frac{pb^{p}}{(b^{p} − 1)^{2}} ∑_{1≤n≤p} \frac{d_{n}}{b^{n}} + \frac{b^{p}}{b^{p} − 1} ∑_{1≤n≤p} \frac{nd_{n}}{b^{n}} + \frac{kb^{p}}{b^{p} − 1} ∑_{1≤n≤p} \frac{d_{n}}{b^{n}}

by b^{p} − 1 gives

z_{0}(b^{p} − 1) = \frac{p ∑_{1≤n≤p} d_{n}b^{p−n}}{b^{p} − 1} + ∑_{1≤n≤p} nd_{n}b^{p−n} + k ∑_{1≤n≤p} d_{n}b^{p−n}

Since the terms z_{0}(b^{p} − 1), ∑_{1≤n≤p} nd_{n}b^{p−n}, and k ∑_{1≤n≤p} d_{n}b^{p−n} are integers, it must be

that ^{\frac{p ∑_{1≤n≤p} d_{n}b^{p−n}}{b^{p}−1}} is also an integer, and so b^{p} − 1 must divide p ∑_{1≤n≤p} d_{n}b^{p−n}. From Lemma 1(c), d_{n} < b − 1 for at least one n with 1 ≤ n ≤ p, and so ∑_{1≤n≤p} d_{n}b^{p−n} < ∑_{1≤n≤p}(b − 1)b^{p−n} = b^{p} − 1. It follows that either (1) ∑_{1≤n≤p} d_{n}b^{p−n} = 0, and hence p = 1, and d_{1} = 0 or (2) ∑_{1≤n≤p} d_{n}b^{p−n} > 0, and hence gcd(p, b^{p} − 1) > 1 and p > 1. To complete the proof, we will show case (1) must be correct, and so, by Lemma 1(d), the (original) sequence {z_{n}} is eventually 0. To that end, we assume gcd(p, b^{p} − 1) = s > 1 (and consequently p > 1) and derive a contradiction.

Let r be the order of b modulo s, so that r ≤ φ(s) where φ is Euler’s phi function. Since b^{p} ≡ 1 (mod s), it follows that r divides p.

Now s > 1 and s|p, and so it follows that r < p since r ≤ φ(s) < s ≤ p. Since r is a divisor of p, but strictly less than p, we have p = mr for some integer m > 1. Moreover, there is an integer a, with 1 ≤ a < b^{r} − 1, such that sa = b^{r} − 1. By telescoping we see

s [a + ab^{r} + ab^{2r} + ⋯ + ab^{(m−1)r}] = b^{p} − 1.

It follows that

u = \frac{b^{p} − 1}{s} = a + ab^{r} + ab^{2r} + ⋯ + ab^{(m−1)r}

has periodic base-b digits with a period length r.

Now u = \frac{b^{p}−1}{s} and \frac{p}{s} are relatively prime, while

u = \frac{b^{p} − 1}{s} divides \frac{p}{s} ∑_{1≤n≤p} d_{n}b^{p−n}.

So for some v > 0, we have that

vu = ∑_{1≤n≤p} d_{n}b^{p−n} < b^{p} − 1 = su.

That implies 0 < v < s and consequently 0 < va < sa = b^{r} − 1.

Hence, the integer va has base-b expansion involving only powers of b less than r. Consequently

∑_{1≤n≤p} d_{n}b^{p−n} = vu = v [a + ab^{r} + ab^{2r} + ⋯ + ab^{(m−1)r}]

has periodic base-b digits with period length r. It follows that the base-b expansion ∑_{n≥1} \frac{d_{n}}{b^{n}} is periodic with a period r < p, which violates the choice of p as the minimal period length and the proof is complete.

Without regard to the rationality condition, our data shows that, in every tested instance, a rumor as in Theorem 2 is eventually zero. Thus, we have been led to postulate the following conjecture.

Conjecture 3. With the notation as in Theorem 2, ∑_{n≥1} \frac{d_{n}}{b^{n}} is rational, and hence every such

rumor is eventually 0.

3 Rumors and the Josephus Problem

Rumors are related to the Josephus problem variation as described by Graham, Knuth, and Patashnik [1] and Jensen [2]. Arrange the integers 0 to n − 1 in a circle. Beginning at 0, delete every second remaining number until only one number remains. That last remaining value is denoted by J_{n}. Taking J_{0} = 0, it is easy to see that the numbers J_{n} obey the running modulus recursion

J_{0} = 0
J_{n} = (J_{n−1} + 2) mod n for n ≥ 1.

Generalizing that rumor leads to consideration of rumors of the form

x_{0} = some nonnegative integer
x_{n} = (bx_{n−1} + c) mod n for n ≥ 1

where b, c are positive integers.

Such generalized Josephus rumors exhibit a number of unexpected behaviors, most of which are supported presently by empirical evidence only. The most remarkable observation is that, for certain pairs b, c, all such sequences appear to synchronize in the sense described in the following conjecture.

Conjecture 4. For the sequence {x_{n}} given above, if c = j(b − 1) + 1 for some j ≥ 2, then eventually x_{n} = n − j + 1.

So when b and c are related as in the conjecture, it appears the sequence eventually becomes a sequence of consecutive integers. In this case we say the rumor sequence eventually walks. In particular then, for any initial term, x_{0}, as long as c = j(b − 1) + 1, any two such sequences will eventually synchronize in the sense that eventually corresponding terms will differ by a fixed constant, and for a fixed j ≥ 2 for any two b ≥ 2 and any x_{0}, the sequences are eventually identical.

On the other hand, if b and c are not related as described, it appears the sequence never walks, and in fact the terms show no easily discernible pattern at all.

When a sequence does walk, the point at which the walk begins is surprisingly variable, which may partly explain the difficulty establishing the conjecture. For example, the rumor

x_{0} = 0
x_{n} = (2x_{n−1} + 291) mod n for n ≥ 1

begins walking at term number 570.

On the other hand, the rumor

x_{0} = 0
x_{n} = (2x_{n−1} + 292) mod n for n ≥ 1

begins walking at term number 69921608358, while

x_{0} = 0
x_{n} = (2x_{n−1} + 293) mod n for n ≥ 1

begins walking at term number 13942.

The rumor given by x_{0} = 0 and x_{n} = (2x_{n−1} + c) mod n for n ≥ 1 will eventually walk for all c ≥ 3 according to Conjecture 4. For 3 ≤ c ≤ 23, the walks begin at

1, 2, 8, 32, 6, 8, 38, 38, 48, 16, 384, 174, 24, 34, 16, 120, 26, 26, 680, 680, 5600, …

4 Acknowledgements

The authors would like to thank the referee for the many comments that improved both the content and style of this paper.

References

[1] R. Graham, D. Knuth, O. Patashnik, Concrete Mathematics, 2^{nd} ed., Addison-Wesley, 1994.

[2] B. Jensen, The Running Modulus, Master’s Independent Study, University of North Dakota, 2000.

2000 Mathematics Subject Classification: Primary 11B37; Secondary 11B50. Keywords: recurrence sequence, recurrence relation modulo m, Josephus problem, running modulus recursion

Received December 2 2009; revised version received January 12 2010. Published in Journal of Integer Sequences, January 14 2010.

Return to Journal of Integer Sequences home page.