invModPowerOf2
Computes the modular inverse of n modulo a power of 2: n^-1 mod 2^k.
Uses Newton's method to iteratively compute the inverse, doubling precision at each step.
Parameters
n | The value to invert (must be odd for inverse to exist) |
k | The power of 2 for the modulus |
Returns
n^-1 mod 2^k