Digit Tools: Digit Sum, Reverse, Sort, Palindromes
Apply one digit operation to a list of integers of any size: digit sum and product, increment, delete, replace, reverse, shuffle or sort digits, palindromes, sign, thousands separators, chunks and fancy Unicode digits. Results one per line. Nothing is uploaded.
0 characters, 0 bytes
0 characters, 0 bytes
About the digit tools
This page applies one digit operation to every integer in a list. Type or paste integers one per line, or separated by commas or spaces, choose an operation, and read one result per line. There are nineteen operations: digit sum and digit product, incrementing and decrementing every digit, deleting, replacing, reversing, separating, shuffling and sorting digits, checking and building palindromes, changing the sign, adding or removing thousands separators, splitting an integer into chunks, destroying a share of the digits and writing the digits in fancy Unicode fonts. Integers may have up to 10,000 digits each, and up to 100,000 integers can be processed at once. Nothing is uploaded: every calculation runs in your browser.
How to use the digit tools
Steps
- Pick an operation from the Operation list. Each operation shows only the settings it needs.
- Type or paste your integers. A leading minus sign is kept, a plus sign is accepted, and leading zeros stay as typed.
- Read the results in the output box, one line for each integer, then press Copy or Download .txt.
- For a shuffle or a destroy, press Shuffle again or Destroy again for a new random result.
The operations
Arithmetic
The digit sum adds the digits, so 98765 gives 35, and can also show the digital root, the single digit you reach by summing again and again (8 here). The digit product multiplies the digits exactly, at any size, with an option to skip zeros. Increment and decrement add or subtract a step from every digit on its own, with no carry: past 9 the digit either wraps around to 0 or stays clamped at 9, so 1789 incremented by 2 gives 3901 or 3999.
Editing digits
Delete removes digits by position, counted from the left or the right, or by value. Replace applies a digit map such as 1=7, 2=8 in one pass, so swaps work. Reverse, sort (ascending or descending), separate (any separator between digits) and shuffle (with an option to keep a non-zero leading digit) keep the sign in front.
Palindromes
Check palindrome answers yes or no for each integer, ignoring the sign. Create palindrome mirrors the digits, 123 becoming 12321 with a shared middle digit or 123321 in full. Convert to palindrome finds the smallest palindrome not below the integer (123 gives 131), or repeatedly adds the reversal until a palindrome appears and reports the number of steps: 89 needs 24 steps to reach 8813200023188. Some numbers, such as 196, never seem to reach one, so a step limit applies.
Formatting
Change sign negates, or forces every integer positive or negative. Add thousands separators groups digits with a comma, dot, space or apostrophe, in thousands (1,234,567) or in the Indian lakh and crore system (12,34,567). Remove thousands separators reads each line as one integer and strips those characters again. Split cuts the digits into chunks of any size from the left or right. Destroy replaces or deletes a random share of the digits, and fancy font rewrites them as bold, double-struck, sans-serif, monospace, circled, superscript, subscript or fullwidth Unicode digits.
Related tools
To total, average or filter a list of numbers rather than work on digits, use the Number List Calculator. To sort or shuffle whole lines, use the List Sorter, and to create test integers, use the Random Number Generator. For digit sums on their own, the Digit Sum Calculator opens this tool on that operation.
Open-source credits
- The digit tools are implemented in-house for this site and use no third-party library. Digit products use the browser's built-in
BigIntfrom ECMA-262, the ECMAScript language specification; the other operations work on the digit strings directly. - The digital root follows the formula 1 + (n − 1) mod 9, and the tests check it against OEIS A010888.
- Reverse-and-add follows the 196 problem as described in OEIS A023108, and the tests check the step counts of OEIS A033665.
- Fancy digits use the code points of the Unicode Standard's Mathematical Alphanumeric Symbols, Enclosed Alphanumerics, Superscripts and Subscripts, and Halfwidth and Fullwidth Forms blocks. Shuffles and random destruction use the browser's Web Crypto API.
Frequently asked questions
How are the integers in the input separated?
Integers may be on separate lines or separated by commas and spaces, in any mix. The one exception is removing thousands separators: there each line is read as a single integer, because grouped numbers such as 1,234,567 contain commas and spaces themselves.
What happens to a minus sign or leading zeros?
A leading minus sign is kept in front of the result, so reversing -120 gives -021, while a plus sign is accepted and dropped. Leading zeros stay exactly as typed unless an option, such as removing leading zeros after a reversal, says otherwise.
How large can the integers be?
Each integer may have up to 10,000 digits, and up to 100,000 integers can be processed in one go. Digit operations work on the digit strings directly and the digit product uses exact BigInt arithmetic, so nothing is rounded however long the number is.
What is the difference between wrap-around and clamping?
Incrementing or decrementing changes every digit separately, with no carry into the next one. With wrap-around a digit that passes 9 starts again at 0, like a dial, while clamping stops it at 9, and going below 0 works the same way in reverse.
Why does reverse-and-add sometimes find no palindrome?
Some numbers, the smallest being 196, have never been seen to reach a palindrome however many reversals are added, although nobody has proved that they never will. The tool therefore stops after the step limit you choose and says that no palindrome was found.
Are shuffles and destroyed digits truly random?
Both use the browser's cryptographic random number generator with rejection sampling, so every arrangement of the digits is equally likely. Press Shuffle again or Destroy again to draw a new result for the same input without retyping anything.