• + 0 comments

    long strangeCounter(long t) { long b = 1, tmp = 3, idx = 3, j; while (idx < t){ b += tmp; tmp *= 2; idx += tmp; } j = t - b + 1; return tmp - j + 1; }