Decompose a number into 2 prime co-factors
问题 One of the requirements for Telegram Authentication is decomposing a given number into 2 prime co-factors. In particular P*Q = N, where N < 2^63 How can we find the smaller prime co-factor, such that P < square_root(N) My Suggestions: 1) pre-compute primes from 3 to 2^31.5 , then test if N mod P = 0 2) Find an algorithm to test for primes (but we still have to test N mod P =0 ) Is there an algorithm for primes that is well suited to this case? 回答1: Ugh! I just put this program in and then