Ask Your Question

Revision history [back]

Best way to divide by 2^n?

What would be the best way to divide an integer by 2^n in SAGE, where n is unknown? Specifically, I want to determine the value of x in integers of the following form (2^n)*x, but I don't know n. ATM, I'm dividing by 2, then test whether result is 1 (mod2) and repeat if necessary. Is there a better way?

Thanks CL

Best way to divide by 2^n?

What would be the best way to divide an integer by 2^n in SAGE, where n is unknown? Specifically, I want to determine the value of x in integers of the following form (2^n)*x, but where x is odd and I don't know n. ATM, I'm dividing by 2, then test whether result is 1 (mod2) and repeat if necessary. Is there a better way?

Thanks CL

Best way to divide by 2^n?

What would be the best way to divide an integer by 2^n in SAGE, where n is unknown? Specifically, I want to determine the value of x in integers of the following form (2^n)*x, where x is odd and I don't know n. ATM, I'm dividing by 2, then test whether result is 1 (mod2) and repeat if necessary. Is there a better way?

edit: I prefer not to use factor() as x may be large (which would make factor() slow). I just want to identify x, not its factors.

Thanks CL