HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Numbers of ways of expressing the sum of a number between [a,b]

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
expressingthenumbernumberswaysbetweensum

Problem

I need an algorithm to calculate the number of ways of expressing a number N as sum of numbers inside the interval [a, b]

Solution

What you want is the number of integer partitions restricted to the interval $[a,b]$. I suggest you take a look at the approaches to count all partitions (check references and external links of the article) and adapt it to your needs.

Context

StackExchange Computer Science Q#2273, answer score: 4

Revisions (0)

No revisions yet.