About this Journal Submit a Manuscript Table of Contents
International Journal of Mathematics and Mathematical Sciences
VolumeΒ 2010Β (2010), Article IDΒ 458563, 6 pages
Research Article

The 3π‘₯+1 Problem as a String Rewriting System

Quatronet Corporation, 50 Almond Ave, Thornhill, Ontario, Canada L3T 1L2

Received 11 May 2010; Accepted 31 December 2010

Academic Editor: KennethΒ Berenhaut

Copyright Β© 2010 Joseph Sinyor. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.


The 3π‘₯+1 problem can be viewed, starting with the binary form for any π‘›βˆˆπ, as a string of β€œruns” of 1s and 0s, using methodology introduced by BΕ‚aΕΌewicz and Pettorossi in 1983. A simple system of two unary operators rewrites the length of each run, so that each new string represents the next odd integer on the 3π‘₯+1 path. This approach enables the conjecture to be recast as two assertions. (I) Every odd π‘›βˆˆπ lies on a distinct 3π‘₯+1 trajectory between two Mersenne numbers (2π‘˜βˆ’1) or their equivalents, in the sense that every integer of the form (4π‘š+1) with π‘š being odd is equivalent to π‘š because both yield the same successor. (II) If π‘‡π‘Ÿ(2π‘˜βˆ’1)β†’(2π‘™βˆ’1) for any π‘Ÿ,π‘˜,𝑙>0, 𝑙<π‘˜; that is, the 3π‘₯+1 function expressed as a map of π‘˜'s is monotonically decreasing, thereby ensuring that the function terminates for every integer.

1. Introduction

The 3π‘₯+1 problem is also known under various other names including Collatz’s problem, Ulam’s problem, and the Syracuse problem. It considers the following transformation of integers: 𝑓(π‘₯)=(3π‘₯+1)ifπ‘₯isodd,π‘₯2ifπ‘₯iseven.(1.1) The conjecture states that, starting with any integer 𝑛 (which for our purposes we will take as positive, although there is a negative version), 𝑓(π‘₯) will eventually reach 1 under iteration of the function. Thereafter it will enter the short cycle 4, 2, 1. The conjecture specifies that there are no other cycles and also that the function is not divergent. Another commonly used notation is π‘‡π‘˜(𝑛) for the value after π‘˜ iterations.

The conjecture has been verified up to 26 × 255 as of April 2010 in independent computations by Oliveira e Silva [1] and Roosendaal [2].

In this paper we will use another version of the problem𝑓π‘₯𝑖=3π‘₯π‘–βˆ’1+12π‘šπ‘–βˆ’1,π‘₯0=𝑛,(1.2) such that 2π‘šπ‘–βˆ’1∣3π‘₯π‘–βˆ’1+1 but 2π‘šπ‘–βˆ’1+1 does not divide it.

This version iterates directly from one odd integer to another, and the conjecture states that π‘₯𝑖=1 for some finite value of 𝑖. However, this form is less often used by researchers because of the difficulty of determining a priori the values of π‘šπ‘–βˆ’1.

For a comprehensive review of the research to date, see Lagarias’ annotated bibliography and generalizations of the problem [3–5] and Chamberland’s 2003 update [6]. Wirsching’s lecture notes [7] consider the dynamical system generated by the function. Shallit [8] treats the function from the viewpoint of finite automata.

Our approach builds on BΕ‚aΕΌewicz and Pettorossi’s 1983 paper [9] in which they introduce the notion of viewing the binary representation as an alternating series of β€œruns” of 1s and 0s. These can be rewritten using two unary operators and include appending a carry 1 as necessary to the output string to achieve the iterations correctly according to the 3π‘₯+1 algorithm.

Clearly the binary notation can be expressed as lengths of runs. For example, we express 𝑛=27 as 𝟏2𝟎1𝟏2. We point out that this particular starting point is especially interesting becauseβ€”as noted by several writersβ€”it generates one of two of the longest trajectories for values of 𝑛<103. As Table 1 shows, 41 steps are required to reach 1 in terms of odd integers. The other long trajectory in that range is for 𝑛=703.

Table 1: 3π‘₯+1 path (odd integers) for 𝑛=27 expressed in integer and run notations.

We will dispense with explicitly showing 1s and 0s unless otherwise indicated because, as we will show, the same rewriting rules apply to both. Hence 𝑛=27 becomes {212}, and all positive odd integers are represented in this way, the only constraint being that the string is of odd length. Even values of 𝑛 appear as trailing 0s and are simply deleted in the rewriting process.

2. The String Rewriting System (SRS) for the 3π‘₯+1 Problem

We will now list the String Rewriting System (SRS) process specific to the 3π‘₯+1 problem and then prove that it replicates the algorithm for odd integers. Since the rewriting will involve deletions as well as additions, for convenience, we will invert the normal sequence, so that deletions occur on the left (least significant digits) and additions of carry 1s at right (most significant digits).(i)At the start of each iteration, we delete any leading 1s in pairs. This action corresponds to the removal of (4π‘˜+1) factors whenever π‘˜ is odd, which has no impact on the calculation.(ii)Reset the output string to a null string.(iii)Apply the following rewriting rules, one integer at a time, and concatenate to the output string, using the unary operators 𝑓 and 𝑔. Every iteration starts with 𝑓:(i)forπ‘˜=1𝑓1β†’+1𝑔or(𝑔1β†’+1𝑓,ii)forπ‘˜=2𝑔2β†’2𝑔or(𝑓2β†’11𝑔,iii)forπ‘˜β‰₯3π‘”π‘˜β†’1(π‘˜βˆ’2)1𝑔or(π‘“π‘˜β†’(π‘˜βˆ’1)1𝑔,iv)forπ‘˜=πœ‘(endofinputstring),π‘”πœ‘βŸΆ1𝑓.(2.1) Note that, while in general we concatenate to the output string, the + sign (first rule) requires that we add 1 to the last integer on the output string. If there is no previous integer (output string is empty), then the 1 is simply discarded.

Proof. For this proof only, we will revert to the usual binary representation (least significant digits at right) and perform the 3𝑛+1 calculation by adding a 1 to the right of 𝑛 and add 𝑛. We summarize some findings of BΕ‚aΕΌewicz and Pettorossi as follows.(i)A run 𝜌 of 1s is translated by the function into 0𝜌0, and a run of 0s changes to 1𝜌1, so long as the length of 𝜌 satisfies |𝜌|β‰₯2. For example, runs of |𝜌|=5 are shown pictorially as follows; the operation 𝑓 5 is on the left and 𝑔 5 is on the right: 458563.fig.00i(2.2)(ii)An alternating series of 1 and 0 results in a string of 0s 458563.fig.00ii(2.3) this corresponds to a succession of (4π‘˜+1) factors which can be removed if they occur at right.(iii)Single 0s or 1s disappear into the structures of their neighbors 458563.fig.00iii(2.4)(iv)It is easily seen that the rewriting rules (ii) and (iii) maintain the parity of the string for operator 𝑔 and change it to even for 𝑓. Rule  1 has no effect on the parity. Hence, if the output string (which always starts with 𝑓) ends with 𝑔, we must add a 1 (the carry bit) to it to preserve the requirement that its length be odd.Rule (ii) can similarly be proved. Using the above, one can confirm that the rewriting rules (2.1) satisfy all the requirements of the 3π‘₯+1 algorithm.

The above SRS has some useful properties.

A Mersenne number (2π‘˜βˆ’1) which in binary is a row of π‘˜ 1s is represented in our notation simply as {π‘˜}.

It is easy to see that every integer of the form (4π‘š+1) with π‘š being odd is equivalent to π‘š because both yield the same successor. In binary, the string for an odd integer π‘š is followed by a 0 and a 1 to produce (4π‘š+1). In our notation this translates even more simply as a pair of leading 1s. Given any odd integer one can write or immediately recognize an infinite number of equivalents simply by adding (or removing) pairs of 1s. Only adding 1s in pairs will maintain the correct parity of the string.

3. The 3π‘₯+1 Problem and Mersenne Numbers

It is rather surprising that the Mersenne numbers should play a helpful role in the 3π‘₯+1 problem becauseβ€”as several writers have noted, for example, Kuttler [10]β€”it is easy to show that π‘‡π‘˜(2π‘˜βˆ’1)=(3π‘˜βˆ’1); that is, the values appear to grow quickly (we caution here that Kuttler uses a variant of our definition (1.1) which results in a different set of iterations). However, if we complete the numerical evidence for small values of π‘˜ (≀20), an interesting structure emerges. Figure 1 shows each vertex containing the π‘˜th Mersenne number and each edge representing the 3π‘₯+1 trajectory from that π‘˜th Mersenne number to the next. For example, the trajectory for 𝑛=27 is largely represented by the single edge between π‘˜=5 and π‘˜=4, that is, 𝑛=31 and 𝑛=61, where the latter is the equivalent of 𝑛=15 which cannot have a predecessor since it is 0 (mod3). Note that all the values of π‘˜ in Figure 1 are monotonically decreasing in the direction of the arrows.

Figure 1: The 3π‘₯+1 map expressed as values of π‘˜β‰€20 for endpoints (2π‘˜βˆ’1).

Define as usual the stopping time of 𝑛, denoted by 𝜎(𝑛), as being the least π‘˜ such that π‘‡π‘˜(𝑛)<𝑛. It is easy to verify, as in Garner [11], the following stopping times; the 𝜎(𝑛) have been adjusted to count odd integers only: 𝜎(𝑛)=1if𝑛≑1(mod4),𝜎(𝑛)=2if𝑛≑3(mod16),𝜎(𝑛)=3if𝑛≑11or23(mod32),𝜎(𝑛)=4if𝑛≑7,15or59(mod128),𝜎(𝑛)=5if𝑛≑39,79,95,123,175,199,or219(mod256).(3.1)

Equivalently (see [12]), 𝜎(𝑛)≀5 unless 𝑛 is congruent mod 256 one of the following:2731476371103111127155159167191207223231239251255.(3.2) Clearly we can always find an 𝑛 with arbitrarily long stopping time 𝜎(𝑛)=π‘˜. In our run notation, this means simply choosing an integer of the form {π‘˜β‹―}. So stopping times alone will not suffice to resolve the problem. Looking at Figure 1 suggests that we consider the 3π‘₯+1 problem as a combination of two propositions: one for predecessors and another for successors.(i)First we must show that every odd π‘›βˆˆπ lies on the map described by Figure 1, either on the path between two Mersenne numbers (2π‘˜βˆ’1) or as the Mersenne numbers themselves. While we cannot predict where a particular 𝑛 will fall on the map, we can say that this corresponds to the hypothesis that every 𝑛 or an equivalent must have a Mersenne number as a predecessor. This condition is met if we can always find a valid predecessor of 𝑛 smaller than 𝑛; that is, π‘‡βˆ’π‘˜(𝑛)<𝑛, identical to the stopping time condition except in the reverse direction. Note that, if 𝑛 is 0 (mod3), we can convert it to an equivalent (in fact an infinite number of them) which has a valid predecessor. (ii)The second proposition is that if π‘‡π‘Ÿ(2π‘˜βˆ’1)β†’(2π‘™βˆ’1) for any π‘Ÿ,π‘˜,𝑙>0, 𝑙<π‘˜; that is, the 3π‘₯+1 function expressed as a map of π‘˜β€™s is monotonically decreasing, thereby ensuring that the function terminates for every integer. Note that we need only to concern ourselves here with Mersenne numbers, not all the points in between.

Hence a counterexample must satisfy π‘‡π‘˜(𝑛)>𝑛 for all π‘˜β€™s (positive and negative); that is, 𝑛 must be a minimum with respect to its successor trajectory as well as its infinite number of predecessor paths.

It remains to be seen whether the String Rewriting System (SRS) approach can lead to further advances in the 3π‘₯+1 problem.


  1. T. Oliveira e Silva, β€œMaximum excursion and stopping time record-holders for the 3x+1 problem: computational results,” Mathematics of Computation, vol. 68, no. 225, pp. 371–384, 1999. View at Publisher Β· View at Google Scholar Β· View at Zentralblatt MATH Β· View at MathSciNet
  2. Eric Roosendaal, http://www.ericr.nl/wondrous/index.html.
  3. J. C. Lagarias, β€œThe 3x+1 problem: an annotated bibliography (1963–1999),” http://arxiv.org/abs/math/0309224.
  4. J. C. Lagarias, β€œThe 3x+1 problem: an annotated bibliography, II (2001–2009),” http://arxiv.org/abs/math/0608208.
  5. J. C. Lagarias, β€œThe 3x+1 problem and its generalizations,” The American Mathematical Monthly, vol. 92, no. 1, pp. 3–23, 1985. View at Publisher Β· View at Google Scholar Β· View at Zentralblatt MATH Β· View at MathSciNet
  6. M. Chamberland, β€œAn update on the 3x+1 problem,” Butlletí de la Societat Catalana de Matemàtiques, vol. 18, no. 1, pp. 19–45, 2003.
  7. G. J. Wirsching, The Dynamical System Generated by the 3n+1 Function, vol. 1681 of Lecture Notes in Mathematics, Springer, Berlin, Germany, 1998.
  8. J. O. Shallit, β€œThe 3x+1 problem and finite automata,” Bulletin of the AETCS, no. 46, pp. 182–185, 1992.
  9. J. Błażewicz and A. Pettorossi, β€œSome properties of binary sequences useful for proving Collatz's conjecture,” Foundations of Control Engineering, vol. 8, no. 2, pp. 53–63, 1983. View at Zentralblatt MATH
  10. J. R. Kuttler, β€œOn the 3x+1 problem,” Advances in Applied Mathematics, vol. 15, no. 2, pp. 183–185, 1994. View at Publisher Β· View at Google Scholar Β· View at Zentralblatt MATH Β· View at MathSciNet
  11. L. E. Garner, β€œOn the Collatz 3n+1 algorithm,” Proceedings of the American Mathematical Society, vol. 82, no. 1, pp. 19–22, 1981. View at Publisher Β· View at Google Scholar Β· View at Zentralblatt MATH
  12. V. Klee and S. Wagon, Old & New Unsolved Problems in Plane Geometry & Number Theory, vol. 11 of The Dolciani Mathematical Expositions, Mathematical Association of America, Washington, DC, USA, 1991.