Link of the problem statement: https://www.codechef.com/FEB19B/problems/GUESSRT

`In the problem Guess it Right, won't the given problem form a GP(geometric progression). Consider if the given number of moves are odd: In the first step play will guess, and then in the next step, he will remove those 'k' boxes which were added in the first step. This will continue till player reaches 'M' number of moves. Let m=5;k=23;n=3 The probability will be: P=1/3+(2/3)*(1/3)+(2/3)*(2/3)*(1/3) This forms a GP. Similarly, we can do the same for even numbers, only one extra fraction will be added. Let m=6;k=23;n=3 P=(1/3)+(2/3)*(1/3)+(2/3)*(2/3)*(1/3)+(2/3)*(2/3)*(2/3)*(1/26) Again we will get a GP(excluding the last term). I used this logic to solve the problem, what's wrong in this?`

Edit: I have corrected the first term in the odd case and the last term in the even case. My code for the solution using python is given in comment section.