Finding out which prime factors a integer is made up by

In summary, this conversation discusses various methods for finding prime factors of any given integer. The first method discussed is trial division, where the integer is divided by potential prime factors until only prime numbers remain. This method can be slow but is reliable. Other methods such as Fermat's factorization method and the General Number Field Sieve are also mentioned, which are faster but more mathematically involved. It is also noted that Shor's algorithm, which can run on a quantum computer, is the fastest method but is not yet practical. Finally, the conversation also touches on the topic of elliptic curves and a website that allows for quick factorization of large integers.
  • #1
ull
6
0
Is this line of thought correct? Please correct me where I´m wrong.

Will this way of finding prime factors work when A is any integer?

Is there a proof for this or a proof that is closely related?

Is there a way to do it that requiers less iterations? It has to be a method that requires no intelligence ;)

A = any integer
B = prime number

If A / B is evenly divisible then B is a prime factor of A

The first time A is devided by 2, then 3, 5, 7, 11...

Example:
2*5*5*5*5*7 = 8750 = A
8750/2= 4375
4375/3 is not an integer
Now the prime number 3 is ruled out as a possible prime factor of 8750
4375/5 = 875
875/7 = 125
125/11 is not an integer
Now the prime number 11 is ruled out as a possible prime factor of 8750
125/13 is not an integer
Now the prime number 13 is ruled out as a possible prime factor of 8750
...
The ratio is not an integer
Now the prime number n is ruled out as a possible prime factor of 8750
...
The next prime, 67, is greater than 125/2. Can you still find the prime factors if you stop deviding before prime number n is greater than the last ratio that was an integer?

We have found the greatest prime factor that 8750 is made up by and some of the rest but not all of them since the ratio isn´t 1. So far we have found 2,5 and 7

125/2 is not an integer
Now the prime number 2 is ruled out as a possible prime factor of 8750
We have already ruled out 3 and there is no need to divide by it again
125/5 = 25
25/7 is not an integer
Now the prime number 7 is ruled out as a possible prime factor of 8750
25/5 = 5
5/5 = 1
Now we have found all prime factors that 8750 is made up by. They are 2,5,5,5,5 and 7
 
Last edited:
Mathematics news on Phys.org
  • #2
Now the prime number 3 is ruled out as a possible prime factor of 8750
4375/5 = 875
Don't stop there, keep testing 5:
875/5=175
175/5=35
35/5=7
Done.

Can you still find the prime factors if you stop deviding before prime number n is greater than the last ratio that was an integer?
You can stop earlier: at the square root of the last number you got. Suppose x is divisible by y where y2>x. Call this z: z=x/y. Then z < y and you would have found a smaller factor.

As an example, you will never have to test if 143 is divisible by 13 (it is): 143/13=11, so 143 is divisible by 11 as well (with 143/11=13), and that prime gets tested first.

Will this way of finding prime factors work when A is any integer?
Yes it will. It is a very slow, but reliable way to find all prime factors.
 
  • #3
Is the faster ways of finding prime factors less reliable? If so, in what sense?
 
  • #4
All prime factorization algorithms we know of so far are "slow" (in the sense that the time is not bound by a polynomial in the number of bits of the integer). The trial division approach (both up to n and up to sqrt(n) ) are exponential time, because the number of trials increases roughly exponentially in the number of bits of n.

There are faster (and equally reliable) algorithms, which are much more involved mathematically and I don't know much about them, but even the best so far would take impractical amount of time to factor a 100-digit number. Here's wikipedia articles for more info:
http://en.wikipedia.org/wiki/Trial_division
http://en.wikipedia.org/wiki/Fermat's_factorization_method
http://en.wikipedia.org/wiki/General_number_field_sieve (this one is supposedly the fastest yet)

Interestingly, Shor has devised an integer factorization algorithm that can run in polynomial time on a quantum computer and will therefore be very fast. Such computers are not yet practical, but when technology becomes more advanced, this might become a threat to security systems based on RSA or similar cryptosystems.
http://en.wikipedia.org/wiki/Shor's_algorithm
 
Last edited:
  • Like
Likes 1 person
  • #5
Elliptic curves are another method.
You can find prime factors with 20-30 digits within seconds with those methods, where trial divisions (basically the method used in post 1) would need years to millions of years.
 
  • Like
Likes 1 person
  • #6
You can stop earlier: at the square root of the last number you got.
If the square root of the last number isn't an prime number (quadrat/"perfect square") then the last number must be a prime?
 
  • #7
ull said:
If the square root of the last number isn't an prime number (quadrat/"perfect square") then the last number must be a prime?

What would happen if ##p## had no proper prime divisors less than ##\sqrt{p}##? What would its factorization look like?
 
  • Like
Likes 1 person
  • #8
mfb said:
Elliptic curves are another method.
You can find prime factors with 20-30 digits within seconds with those methods, where trial divisions (basically the method used in post 1) would need years to millions of years.

Even faster than that,
http://www.alpertron.com.ar/ECM.HTM
 
  • #9
That's where my time estimate comes from ;).

If you want to try it yourself, here are some prime numbers with many digits:
20: 29300536351978728173
24: 344554212312423565743337
28: 1310092062024424204347289397
31: 2013759277103586006682274175401

344554212312423565743337*2013759277103586006682274175401 (24 digits * 31 digits) gets factorized in 4 seconds.
1310092062024424204347289397*2013759277103586006682274175401 (28 digits * 31 digits) gets factorized in 11 seconds.
 
  • Like
Likes 1 person
  • #10
mfb said:
That's where my time estimate comes from ;).

If you want to try it yourself, here are some prime numbers with many digits:
20: 29300536351978728173
24: 344554212312423565743337
28: 1310092062024424204347289397
31: 2013759277103586006682274175401

344554212312423565743337*2013759277103586006682274175401 (24 digits * 31 digits) gets factorized in 4 seconds.
1310092062024424204347289397*2013759277103586006682274175401 (28 digits * 31 digits) gets factorized in 11 seconds.

Hah!

Finding composites does take longer, primes verification pops up in a fraction of a second for small values like these. It's a great website!
 

1. How do you determine the prime factors of an integer?

To determine the prime factors of an integer, you can use the method of prime factorization. This involves breaking down the integer into its simplest factors until all the factors are prime numbers.

2. What is the fastest way to find the prime factors of a large integer?

The fastest known way to find the prime factors of a large integer is to use a computer algorithm such as the Pollard's rho algorithm or the quadratic sieve algorithm. These algorithms use mathematical techniques to efficiently find the prime factors of a large number.

3. Can all integers be expressed as a product of prime factors?

Yes, all positive integers can be expressed as a product of prime factors. This is known as the fundamental theorem of arithmetic. However, negative integers and 0 do not have unique prime factorizations.

4. How does finding prime factors relate to cryptography?

Prime factorization plays a crucial role in modern cryptography, specifically in the field of RSA encryption. The security of RSA encryption is based on the fact that it is difficult to determine the prime factors of a large number.

5. Are there any real-world applications of finding prime factors?

Yes, prime factorization has several real-world applications. It is used in computer science for efficient data compression and in statistics for data analysis. It is also used in number theory to solve problems related to divisibility and prime numbers.

Similar threads

  • General Math
Replies
3
Views
553
Replies
1
Views
1K
Replies
3
Views
557
Replies
3
Views
771
Replies
4
Views
924
Replies
7
Views
1K
  • General Math
Replies
2
Views
989
  • General Math
Replies
24
Views
2K
  • General Math
Replies
1
Views
564
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
Back
Top