Given two positive numbers n and k, where n>=k. In how many ways can we write n as sum of k positive numbers. Same numbers but different orders are considered different.
Example
For n=5, k=2 the answer is 4.
5 = 1 + 4
5 = 2 + 3
5 = 3 + 2
5 = 4 + 1

Solution Stats

76 Solutions

25 Solvers

Last Solution submitted on May 28, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers25

Suggested Problems

More from this Author5

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!