|<< problem 75 - Singular integer right triangles||Prime summations - problem 77 >>|
Problem 76: Counting summations
It is possible to write five as a sum in exactly six different ways:
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
How many different ways can one hundred be written as a sum of at least two positive integers?
Only very few adjustments to problem 31:
- replace anything related to coins by the numbers 1..100
- finally subtract 1 because the sum has to consist of at least two numbers (not just one)
- for more details on the algorithm itself, please read my explanation of problem 31
proven code is still the fastest way to solve a problem ...
You can submit your own input to my program and it will be instantly processed at my server:
This is equivalent to
echo "1 6" | ./76
Note: the original problem's input
100 cannot be entered
because just copying results is a soft skill reserved for idiots.
(this interactive test is still under development, computations will be aborted after one second)
… was written in C++11 and can be compiled with G++, Clang++, Visual C++. You can download it, too.