Ghost and Shadow were playing a game. Shadow gives Ghost a number n and Ghost has to give cookies to Shadow. The number of cookies is calculated as the maximum divisor of n (not equal to n, of course). For example, if n = 6 the Ghost has to give 3 cookies, while for n = 25 he needs to give 5 and if n = 2 he only needs to give 1 cookie.
As Ghost is very smart he wants to fool Shadow. He introduces a rule saying, that he can break n into several n1 + n2 + ... + nk = n (here k is arbitrary and k = 1 is also possible) and he will give the cookies according to those split parts. ni 2, for all i from 1 to k.
Help Ghost calculate how many cookies he has to give.
What I have tried:
My code is working for splitting number in two parts