TOPICS
Search

Comma Sequence


The comma sequence is the integer sequence constructed by starting with 1 and repeatedly applying the following rule. If the current term is x, the next term is the smallest positive integer y satisfying

 y-x=10d+e,

where d is the last decimal digit of x and e is the first decimal digit of y. If no such y exists, the sequence terminates (Angelini et al. 2024, p. 215). The first terms are 1, 12, 35, 94, 135, 186, 248, 331, 344, 387, ... (OEIS A121805). The name refers to the digits immediately on either side of each comma. For example, in "12, 35" these digits are 2 and 3, forming 23, which equals 35-12. The sequence has exactly 2137453 terms and ends at 99999945 (Angelini et al. 2024, pp. 215-216).

Generalized comma sequences allow any positive integer as the initial term and any base b>=2, with 10d+e replaced by bd+e and the digits read in base b. Dougherty-Bliss and Ter-Saakov (2025, p. 2) gave a computational proof that these sequences terminate for every initial term in each base from 3 through 633.

If the requirement to choose the smallest next term is dropped, each permitted y is called a comma-child of x. The child graph is the directed graph on the positive integers with a directed edge from x to each of its comma-children. It has an infinite path in every base b>=2 (Angelini et al. 2024, p. 223). Randall (2026, pp. 1-2, 6) reports that in base 10 there is a unique infinite path up to deletion of a finite initial segment. Its earliest starting point is 20, and it begins 20, 22, 46, 107, 178, 260, 262, 284, 327, 401, ... (OEIS A367620). Coding the choice of the smaller or larger comma-child at each fork by 0 or 1, respectively, gives the periodic sequence 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, ..., with reported period 314 (OEIS A400003). The terms along the infinite path themselves are increasing, not periodic. The sequence OEIS A400003 was a runner-up in the OEIS 400K celebration contest (OEIS Foundation Inc. 2026).


See also

Digit, Integer Sequence

Explore with Wolfram|Alpha

References

Angelini, É.; Branicky, M. S.; Resta, G.; Sloane, N. J. A.; and Wilson, D. W. "The Comma Sequence: A Simple Sequence with Bizarre Properties." Fibonacci Quart. 62, 215-232, 2024. https://doi.org/10.1080/00150517.2024.12459538.Dougherty-Bliss, R. and Ter-Saakov, N. "The Comma Sequence Is Finite in Other Bases." J. Integer Sequences 28, Article 25.5.5, 1-18, 2025. https://cs.uwaterloo.ca/journals/JIS/VOL28/Dougherty/dough3.html.Numberphile. "The Immortal Kangaroo Sequence." Sep. 4, 2026. https://www.youtube.com/watch?v=A020pGO5MBs.OEIS Foundation Inc. "A400K Winners." 2026. https://oeis.org/wiki/A400K_Winners. Pegg, E. Jr. "Winners of the OEIS 400K Milestone Contest." Wolfram Community. Oct. 26, 2026. https://community.wolfram.com/t/28423.Randall, C. "Infinite Paths in the Comma Child Graph Have Eventually Periodic Branch Sequences." Preliminary notes, Sep. 2026. https://oeis.org/A400003/a400003.pdf.Sloane, N. J. A. Sequences A121805, A367620, and A400003 in "The On-Line Encyclopedia of Integer Sequences."

Cite this as:

Weisstein, Eric W. "Comma Sequence." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/CommaSequence.html

Subject classifications