Write the shortest code you can solving the following problem:
Input:
An integer X with 2 <= X
and X <= 100
Output:
Total combinations of 2, 3, and 5 (repetition is allowed, order matters) whose sum is equal to X.
Examples:
Input: 8
Output: 6
, because the valid combinations are:
3+5
5+3
2+2+2+2
2+3+3
3+2+3
3+3+2
Input: 11
Output: 16
, because the valid combinations are
5+3+3
5+2+2+2
3+5+3
3+3+5
3+3+3+2
3+3+2+3
3+2+3+3
3+2+2+2+2
2+5+2+2
2+3+3+3
2+3+2+2+2
2+2+5+2
2+2+3+2+2
2+2+2+5
2+2+2+3+2
2+2+2+2+3
Input: 100
Output: 1127972743581281
, because the valid combinations are ... many
Input and output can be of any reasonable form. The lowest byte count in each language wins. Standard code-golf rules apply.
sum
in them was not a good idea to try to solve that inquiry... \$\endgroup\$ – Magic Octopus Urn Feb 16 '18 at 19:0411
from12
to16
. Of course feel free to fix this if I misunderstood your intention \$\endgroup\$ – Ton Hospel Feb 16 '18 at 19:38