I have been trying to find inverses of large integers (could be upto 2048 bits), such that 1/N has a minimal period p and n its length in binary. (what i actually am interested in finding is the length of the minimal period n)
Now could someone suggest a faster method of either obtaining the inverse upto a precision that's greater than n or some other method of finding n that doesn't take ages to compute...
Further restrictions on N are that it will always be a semi prime number. however the factors are unknown and factorization would take a lot of time thereby gets infeasible.
Use Newton's method to divide quickly. https://en.wikipedia.org/wiki/Newton%27s_method and watch this video https://www.youtube.com/watch?v=AoVI9NWegWw