Calculators
Bounded Integer Composition Calculator
Count exact ordered integer sums with inclusive minimum and maximum values for every part, privately in your browser.
Count ordered sums where every part lies between the same inclusive minimum and maximum. Enter whole numbers from 0 to 1000. Order matters; zero parts form one empty sum only for total zero. Results stay in your browser.
Count ordered sums with bounded parts
A bounded composition writes total n as an ordered sum of k integers, each between the same inclusive minimum a and maximum b. Order matters. For n = 5, k = 2 and bounds 1 to 3, the two solutions are (2, 3) and (3, 2). This also counts dice outcomes: use bounds 1 to 6 for ordinary six-sided dice; it returns an outcome count rather than a probability. Subtract a from each part, leaving target n − ka and values from 0 to b − a. Dynamic programming counts these sums with exact BigInt arithmetic; a sliding window implements D(j, s) = sum of D(j − 1, s − v) over allowed values v. The starting value D(0, 0) = 1 counts the empty sum. Zero parts give one result only for total zero. Totals outside ka to kb give zero. Equal bounds give one result only when n = ka. Inputs accept whole numbers from 0 to 1000 using one to four digits, including leading zeros and surrounding whitespace. Signs, decimals, separators and scientific notation are rejected. The minimum must not exceed the maximum. All calculations run locally without uploading or storing inputs.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
Does order matter?
Yes. The sums 2 + 3 and 3 + 2 count as different outcomes. Every part uses the same inclusive bounds.
Can this count dice sums?
Yes. For two six-sided dice totaling 7, enter total 7, parts 2, minimum 1 and maximum 6. The exact count is 6. This is a count, not a probability.
What happens with zero parts or impossible totals?
Zero parts give one empty sum when the total is zero and zero otherwise. A total below k times the minimum or above k times the maximum has zero solutions.
What are the limits and privacy rules?
Each input must be a whole number from 0 to 1000, and the minimum cannot exceed the maximum. BigInt preserves exact counts. Inputs remain in your browser.