You are viewing a single comment's thread. Return to all 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])
Seems like cookies are disabled on this browser, please enable them to open this website
Little Gaurav and Sequence
You are viewing a single comment's thread. Return to all 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: