# Integer as a sum rewriter

## World's simplest integer tool

This browser-based utility rewrites an integer as a sum of several smaller integers and prints the additive decomposition in the output. You can specify the number of addends in the sum and the number of sums in the options. You can also change the order of the terms, customize the plus sign symbol, and the sum separator and surrounding characters. Created by math nerds from team Browserling.

working with other numbers?
check out number tools!

We also have Online Number Tools — utilities for doing numbery things. Check it out!

A link to this tool, including input, options and all chained tools.

Can't convert.

Integer as a sum rewriter tool
What is a integer as a sum rewriter?

With this online application, you can express an integer as a sum of two or more other positive values. For example, the integer 10 can be written using two terms as 4 + 6, using three terms as 5 + 3 + 2, using four terms as 1 + 4 + 2 + 3, or more terms. The decomposition 4 + 6 is considered to be the same as 6 + 4 because addition is commutative. You can specify the number of addends that need to go in the sum, as well as choose if the integer 0 should be used as an addend. If the zero addend is disabled, then the integer n can be decomposed into a sum that has strictly from 1 to n addends (in case of n addends, they are all 1's). If you allow the use of the zero, then it can consist of any number of addends as you can add as many zeros to an integer as you want and it won't change its value. The larger the input integer, the more integer partitions there are. For example, the integer 12 can be rewritten as a sum of 3 summands in 19 different ways and the integer 120 can be represented as 1238 unique sums. To make sure you get quick results and the output isn't too long, we have limited the output to 100 sums. You can increase or decrease this count in the options. By default, the summands are displayed from the smallest to the largest (for example, 1 + 1 + 2 + 8) but you can change their order in the options and print them from the largest to the smallest (for example, 8 + 2 + 1 + 1) or even in random order (for example, 1 + 8 + 2 + 1). You can also change the "+" sign to any other symbol, print the sums one after another (and not in a column), separate them with custom symbols, and also surround the sums with custom open and close symbols so that the output could immediately be used in Python or JavaScript programming languages. For example, if the open and close symbols are "(" and ")", and the summands are separated by commas, you will get tuples such as "(1, 1, 2, 8)". Integerabulous!

Integer as a sum rewriter examples
Click to use

Sums of Three Addends

In this example, we expand the integer 9 into a sum of three other integers, including the zero integer. It turns out that for this input integer there are twelve unique three-term sums. We print them one per line and display the summands in increasing order and place the regular plus symbol "+" between them.

9

0 + 0 + 9
0 + 1 + 8
0 + 2 + 7
0 + 3 + 6
0 + 4 + 5
1 + 1 + 7
1 + 2 + 6
1 + 3 + 5
1 + 4 + 4
2 + 2 + 5
2 + 3 + 4
3 + 3 + 3

**Required options**

Rewrite an integer as a sum of
this many smaller integers.

Output this many different sums.

Allow "0" as an addend
in integer sums.

Enter a custom plus symbol here.

Separate sums by this char.

Sum open symbol.

Sum close symbol.

Print integer addends from
small to large.

Sums Without Zero

In this example, we disallow the use of zero-summand and generate all possible commutatively-unique sum combinations of the integer 12. Without using a zero, the number of partitions is 11, while using a zero, it would have reached 58. We replace the plus sign with the colon character and output all terms in decreasing order. We make the output comma-separated that prints all sums on the same line and enclose each sum in a pair of curly brackets.

12

{7:1:1:1:1:1}, {6:2:1:1:1:1}, {5:3:1:1:1:1}, {4:4:1:1:1:1}, {5:2:2:1:1:1}, {4:3:2:1:1:1}, {3:3:3:1:1:1}, {4:2:2:2:1:1}, {3:3:2:2:1:1}, {3:2:2:2:2:1}, {2:2:2:2:2:2}

**Required options**

Rewrite an integer as a sum of
this many smaller integers.

Output this many different sums.

Allow "0" as an addend
in integer sums.

Enter a custom plus symbol here.

Separate sums by this char.

Sum open symbol.

Sum close symbol.

Print integer addends from
large to small.

Random Integer Sums

In this example, we split the integer 100 into random sums with eight addends. There are more than one million partitions for this input specification and it's too large to compute. To quickly get usable results, we have limited the output to just 15 values. They are printed in a vertical column as the sum separator symbol is set to "\n".

100

1+1+92+1+1+1+2+1
1+1+4+65+1+1+26+1
74+1+1+18+1+3+1+1
60+13+1+4+1+1+1+19
1+58+2+35+1+1+1+1
25+1+3+6+29+8+9+19
1+18+30+34+4+2+1+10
10+4+1+1+56+20+1+7
3+1+85+1+1+1+7+1
5+1+1+88+1+1+1+2
1+41+8+1+1+1+4+43
1+61+1+10+3+16+1+7
40+1+1+1+4+1+9+43
3+1+1+1+91+1+1+1
1+10+51+2+2+6+5+23

**Required options**

Rewrite an integer as a sum of
this many smaller integers.

Output this many different sums.

Allow "0" as an addend
in integer sums.

Enter a custom plus symbol here.

Separate sums by this char.

Sum open symbol.

Sum close symbol.

Print integer addends in
random order.

Sums for a Large Integer

In this example, we enter a huge integer equal to nine billion and decompose it into sums of four terms. We limit the number of sums in the output to six, as there are nearly infinitely many of them and it would take a very long time to calculate them all. The sums are randomly generated each time when you click on the example and in each case, adding all the terms together produces 9,000,000,000.

9000000000

1711990448 + 1620447777 + 4513236069 + 1154325706
65092647 + 7195252690 + 1087127447 + 652527216
75025523 + 445960474 + 7275699612 + 1203314391
8859019917 + 27328377 + 36962265 + 76689441
3859074492 + 3054860384 + 1950209345 + 135855779
6999192102 + 502145916 + 975841729 + 522820253

**Required options**

Rewrite an integer as a sum of
this many smaller integers.

Output this many different sums.

Allow "0" as an addend
in integer sums.

Enter a custom plus symbol here.

Separate sums by this char.

Sum open symbol.

Sum close symbol.

Print integer addends in
random order.

Redundant Addends

In this example, the number of addends is greater than the input integer. In order to produce 8 terms that add up to the integer 6, some of the addends must be equal to 0. To allow this condition, we have enabled the "Include Zero" option, which creates two or more redundant zero terms in the sums. We print the sums in parentheses, separate terms by the comma character, and place zeros at the beginning of sums.

6

(0, 0, 0, 0, 0, 0, 0, 6)
(0, 0, 0, 0, 0, 0, 1, 5)
(0, 0, 0, 0, 0, 0, 2, 4)
(0, 0, 0, 0, 0, 0, 3, 3)
(0, 0, 0, 0, 0, 1, 1, 4)
(0, 0, 0, 0, 0, 1, 2, 3)
(0, 0, 0, 0, 0, 2, 2, 2)
(0, 0, 0, 0, 1, 1, 1, 3)
(0, 0, 0, 0, 1, 1, 2, 2)
(0, 0, 0, 1, 1, 1, 1, 2)
(0, 0, 1, 1, 1, 1, 1, 1)

**Required options**

Rewrite an integer as a sum of
this many smaller integers.

Output this many different sums.

Allow "0" as an addend
in integer sums.

Enter a custom plus symbol here.

Separate sums by this char.

Sum open symbol.

Sum close symbol.

Print integer addends from
small to large.

Pro tips
Master online integer tools

You can pass input to this tool via

__?input__query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
https://onlineintegertools.com/rewrite-integer-as-sum

__?input__=9&number-of-addends=3&number-of-sums=12&include-zero=true&plus-symbol=%20%2B%20&sum-separator=%5Cn&open-symbol=&close-symbol=&left-to-right=true
All integer tools

Quickly rewrite integer digits using pretty Unicode glyphs.

Quickly generate random two-dimensional integer points.

Quickly generate random three-dimensional integer points.

Quickly print a list of integers that are palindromes.

Quickly convert the given integer to a palindromic integer.

Quickly find all integers in the given text or string.

Quickly make integer digits go in a triangle wave.

Quickly unleash the destructive force of Zalgo on integers.

Quickly find two or more integers that add up to the given integer.

Quickly find several integers that multiply up to the given integer.

Quickly randomize the given sequence of integers.

Quickly mix the order of digits in an integer.

Quickly put integers in increasing or decreasing order.

Quickly sort the individual digits of an integer.

Quickly increase all integers by a certain amount.

Quickly increase individual digits by a certain amount.

Quickly decrease all integers by a certain amount.

Quickly decrease individual digits by a certain amount.

Quickly randomly select an integer from a list of integers.

Quickly create groups from the digits of an integer.

Quickly write integer digits backwards.

Quickly remove one or more digits from an integer.

Quickly replace one or more digits in an integer.

Quickly drop digits from an integer and make it shorter.

Quickly add the thousands separator to integers.

Quickly remove the thousands separator from integers.

Quickly find the largest integer in a list of integers.

Quickly find the smallest integer in a list of integers.

Quickly find the total sum of a bunch of integers.

Quickly find the sum of all the digits in an integer.

Quickly find the total product of a bunch of integers.

Quickly find the product of all the digits in an integer.

Quickly calculate the partial sum of a bunch of integers.

Quickly calculate the partial product of a bunch of integers.

Quickly flip the sign of one or more integers.

Quickly split an integer into chunks of a given length.

Quickly merge partial integers together to form a larger integer.

Quickly round integers up or down to the required precision.

Quickly convert integers to a downloadable picture.

Quickly generate a list of von Neumann ordinals.

Quickly generate a list of Zermelo ordinals.

Quickly generate an ordered sequence of integers.

Quickly generate an ordered list of even integers.

Quickly generate an ordered list of odd integers.

Quickly write an integer spelling in words.

Quickly convert spelled integers to regular integers with digits.

Quickly generate an array of integers for programming.

Quickly find the number of occurrences of digits in integers.

Coming soon
These integer tools are on the way

Draw von Neumann Universe

Create a drawing that visualizes von Neumann hierarchy of sets.

Create Integer n-Tuples

Generate a list of tuples of integers with n elements.

Convert Integers to Unary Base

Quickly convert integers to base one.

Convert Unary Base to Integers

Quickly convert base one to integers.

Convert Integers to Binary Base

Quickly convert integers to base two.

Convert Binary Base to Integers

Quickly convert base two to integers.

Convert Integers to Octal Base

Quickly convert integers to base eight.

Convert Octal Base to Integers

Quickly convert base eight to integers.

Convert Integers to Hex Base

Quickly convert integers to base sixteen.

Convert Hex Base to Integers

Quickly convert base sixteen to integers.

Convert Integers to Base64

Quickly encode integers to base-64.

Convert Base64 to Integers

Quickly decode base-64 to integers.

Change Integer Base

Quickly convert integers to a custom base.

Convert Integers to HTML Entities

Quickly encode integers to HTML encoding.

Convert HTML Entities to Integers

Quickly decode HTML entities to integers.

Convert Integers to URL Encoding

Quickly encode integers to URL (percent) encoding.

Convert URL Encoding to Integers

Quickly decode URL-encoded integers.

Convert Signed Integer to Unsigned

Quickly convert a signed integer to an unsigned integer.

Convert Unsigned Integer to Signed

Quickly convert an unsigned integer to a signed integer.

Create Random Integers

Generate a list of random integers.

Check if an Integer is Symmetric

Check if the given integers are palindromes.

Generate an Integer Matrix

Create a matrix whose entries are all integers.

Generate an Integer Vector

Create a vector with integer coefficients.

Find the Average

Quickly calculate the average value of integers.

Find the Digit Average

Quickly calculate the average value of integer digits.

Clamp Integers

Limit integer values to a range.

Clamp Integer Digits

Limit integer digit values to a range.

Duplicate Integers

Create multiple copies of the input integers.

Rotate Integers

Rotate the digits of an integer to the left or right.

Shift Integer Digits

Move the digits of an integer to the left or right.

Subtract Integers

Quickly find the difference of a bunch of integers.

AND Integers

Quickly apply the bitwise AND operation to integers.

OR Integers

Quickly apply the bitwise OR operation to integers.

XOR Integers

Quickly apply the bitwise XOR operation to integers.

NOT Integers

Quickly apply the bitwise NOT operation to integers.

NAND Integers

Quickly apply the bitwise NAND operation to integers.

NOR Integers

Quickly apply the bitwise NOR operation to integers.

XNOR Integers

Quickly apply the bitwise NXOR operation to integers.

Convert an Integer to Ordinal

Add -st, -nd, -rd, -th suffixes to integers to make them ordinals.

Convert an Oridinal to Integer

Remove -st, -nd, -rd, -th suffixes from ordinals to make them ints.

Filter Integers

Find integers that match a filter (greater, less, equal).

Left-pad Integers

Add padding to integers on the left side.

Right-pad Integers

Add padding to integers on the right side.

Right-align Integers

Position all integers so that they align on the right.

Center Integers

Position all integers so that they align in the middle.

Take Absolute Value of Integers

Turn all integers into positive integers.

Make All Integers Negative

Turn all integers into negative integers.

Convert Integers to Fractions

Rewrite an integer in fractional form.

Convert Fractions to Integers

Extract the numerator and denominator from a fraction.

Find and Replace Integers

Search for all occurrences of an integer and replace it.

Generate Integers from a Regex

Create integers that match the given regular expression.

Generate Small Integers

Create relatively tiny integers.

Generate Big Integers

Create relatively huge integers.

Generate Oscillating Integers

Create a sequence of oscillating integers, such as 123212321.

Color Integers

Add color to integers based on a condition.

Color Integer Digits

Add color to individual digits in the given integers.

Draw an Integer Spiral

Make the digits of an integer go in a spiral shape.

Draw an Integer Circle

Make the digits of an integer go in a circle.

Draw an Integer Box

Fill a box with certain width and height with digits.

Create 2D Integers

Use ASCII art to convert integers to 2-dimensional drawings.

Create 3D Integers

Use ASCII art to convert integers to 3-dimensional drawings.

Decompose an Integer

Decompose an integer into ones, tens, hundreds, etc.

Find Patterns in Integers

Find hidden patterns of numbers in integers.

Subscribe!
Never miss an update

Cool!

Notifications
We'll let you know when we add this tool

Cool!