Little Gaurav and Sequence

  • + 3 comments

    This is a pure math problem. You don't need to do any coding! Approach this like a math problem and solve it on paper then put your result in code.

    My code:

    def solve(n):
        if(n%2==1):
            return(0)
        ln=math.floor(math.log2(n))
        if(ln==0):
            return(2)
        return([0, 6, 2, 8, 4][ln%5])