factorization

What is the fastest factorization algorithm?

I've written a program that attempts to find Amicable Pairs. This requires finding the sums of the proper divisors of numbers. Here is my current sumOfDivisors() method: int sumOfDivisors(int n) { int sum = 1; int bound = (int) sqrt(n); for(int i = 2; i <= 1 + bound; i++) { if (n % i == 0) sum = s...

Pollard rho integer factorization

I am trying to implement Pollard Rho integer factorization in C/C++.Google gives me a Java implementation of the problem here. I don't know Java that well,so what I came up with this.My implemenation in C++ works for most cases but not in few like the one "9999", I used there. I am aware that C++ didn't have Biginteger class so I can't...

Question about relations between two numbers

Is there is any relation between numbers' bits when one is divisible by another? What is the relation between the bits of 36 and the bit sequences of 9 or 4 or 12, or between 10 (1010) and 5 (101), or 21 (10101) and 7 (00111)? Thanks. I am sorry if some sentence is not correct, but I hope you understand what I want. ...

I have a Python list of the prime factors of a number. How do I (pythonically) find all the factors?

I'm working on a Project Euler problem which requires factorization of an integer. I can come up with a list of all of the primes that are the factor of a given number. The Fundamental Theorem of Arithmetic implies that I can use this list to derive every factor of the number. My current plan is to take each number in the list of base p...

Generating all factors of a number given its prime factorization

If you already have the prime factorization of a number, what is the easiest way to get the set of all factors of that number? I know I could just loop from 2 to sqrt(n) and find all divisible numbers, but that seems inefficient since we already have the prime factorization. I imagine it's basically a modified version of a combinations...

Is there a way to optimize reducing many numbers to the same modulus

I am writing a program to do integer factorization and have to reduce a series of numbers to a given modulus. Both the number and the modulus are bigints, say 50 to 100 digits. The number changes but the modulus is always the same. Is there some way to optimize the repeated modulus calculations, perhaps by pre-computing some partial r...