TOPICS
Search

Sort-Then-Add Sequence


The sort-then-add sequence is produced by sorting the decimal digits of a positive integer in nondecreasing order and adding the resulting integer to the original number. Leading zeros in the sorted digit string are discarded when it is interpreted as an integer. The values starting with n=1, 2, ... are 2, 4, 6, 8, 10, 12, 14, 16, 18, 11, 22, 24, ... (OEIS A070196).

A starter is already sorted if its decimal digits are in nondecreasing order. The sorting-then-adding algorithm stops as soon as a sorted number is obtained, including before any addition if the starter is already sorted. Then for n=1, 2, ..., the algorithm terminates on 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 33, ... (OEIS A033862). The orbit starting at 316 begins 316, 452, 697, 1376, 2743, 5090, ... (OEIS A033861). No sorted term is known in this orbit. The sort-then-add persistence of a terminating starter is the number of additions required to reach its first sorted term. The least numbers of sort-then-add persistence n=0, 1, ..., are 1, 10, 65, 64, 175, 98, 240, 325, 302, 387, 198, 180, 550, ... (OEIS A033863).


See also

196-Algorithm, Kaprekar Routine, RATS Sequence, Reverse-Then-Add Sequence

Explore with Wolfram|Alpha

References

Sloane, N. J. A. Sequences A033861, A033862, A033863, and A070196 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Sort-Then-Add Sequence

Cite this as:

Weisstein, Eric W. "Sort-Then-Add Sequence." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Sort-Then-AddSequence.html

Subject classifications