4 kyu
Explosive Sum
2,998 of 8,874surtich
Description:
How many ways can you make the sum of a number?
From wikipedia: https://en.wikipedia.org/wiki/Partition_(number_theory)
In number theory and combinatorics, a partition of a positive integer n, also called an integer partition, is a way of writing n as a sum of positive integers. Two sums that differ only in the order of their summands are considered the same partition. If order matters, the sum becomes a composition. For example, 4 can be partitioned in five distinct ways:
4
3 + 1
2 + 2
2 + 1 + 1
1 + 1 + 1 + 1
Examples
Basic
sum(1) // 1
sum(2) // 2 -> 1+1 , 2
sum(3) // 3 -> 1+1+1, 1+2, 3
sum(4) // 5 -> 1+1+1+1, 1+1+2, 1+3, 2+2, 4
sum(5) // 7 -> 1+1+1+1+1, 1+1+1+2, 1+1+3, 1+2+2, 1+4, 5, 2+3
sum(10) // 42
Explosive
sum(50) // 204226
sum(80) // 15796476
sum(100) // 190569292
See here for more examples.
Algorithms
Mathematics
Fundamentals
Similar Kata:
Stats:
Created | Jan 31, 2014 |
Published | Jan 31, 2014 |
Warriors Trained | 45324 |
Total Skips | 14832 |
Total Code Submissions | 42669 |
Total Times Completed | 8874 |
JavaScript Completions | 2998 |
Haskell Completions | 217 |
Ruby Completions | 295 |
Python Completions | 4304 |
C++ Completions | 980 |
Go Completions | 157 |
Rust Completions | 129 |
Total Stars | 1682 |
% of votes with a positive feedback rating | 90% of 928 |
Total "Very Satisfied" Votes | 769 |
Total "Somewhat Satisfied" Votes | 130 |
Total "Not Satisfied" Votes | 29 |