I was attending a coding competition and this question came up
There is a box containing n chocolates. You can either take 1 chocolate or 3 chocolates at a time until its empty. So in total how many ways you can empty the chocolate for a given n.
Eg: n = 3
ways you can take out is 2 ie:
111
3
ways you can take out when n=4
is 3 ie:
1111
31
13
likewise, I have calculated manually for n=5 -> 4 etc etc..
so the result sequence comes up like 2,3,4,6,9...
I am not able to figure out what kind of relation it has or how do I solve it. I'm not able to figure out what kind of problem it is as well (Permutation, combinations, series?). let me know if I need to post any more details.