You are viewing a single comment's thread. Return to all comments →
JavaScript solution:
function solve(n) { if (n % 2) return 0; let i_max = Math.floor(Math.log2(n)); let res = 0; for (let i = 0; i <= i_max; i++) { res += [6, 2, 4, 8][(2 ** i + 2 * n) % 4]; } return res%10; }
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 →
JavaScript solution: