To find , write in binary. For each bit that is , make the corresponding jump. This decomposes into a sum of powers of . Start at . For each bit position from high to low, if bit is set in , update .
Process all set bits. After processing all bits, you are at . This takes time because has at most bits. Each bit is a constant-time lookup.