The limit of a factoring algorithm

Click For Summary

Discussion Overview

The discussion revolves around the efficiency of factoring algorithms for integers, particularly focusing on the concept of "mirroring" in factor pairs and the implications for determining the number of factors of an integer. Participants explore theoretical aspects, practical implications, and the limitations of existing methods.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Eus introduces the concept of mirroring in factor pairs and suggests that one only needs to check divisors up to the point where the divisor equals the result of the division.
  • Some participants note that the mirroring occurs at the square root of the number, while others emphasize that the square root is not the same as the square root-th factor.
  • There is a discussion about the time complexity of different factoring methods, with comparisons made between sequential checking and more advanced algorithms like Pari/GP.
  • Eus questions the existence of a function that can predict the number of factors of an integer and suggests that if such a function exists, it could indicate when mirroring occurs.
  • Participants clarify the definitions of distinct and indistinct prime factors, with examples provided to illustrate the differences.
  • Some participants propose that checking divisibility can be optimized by using the least common multiple (LCM) of known factors to limit the range of checks needed.

Areas of Agreement / Disagreement

Participants express differing views on the existence and utility of a function to determine the number of factors of an integer. While some agree on the mirroring concept occurring at the square root, there is no consensus on the ease of computing the exact number of factors or the best approach to factoring.

Contextual Notes

Limitations include the dependence on definitions of factors and the complexity of determining the number of factors, which remains unresolved. The discussion also highlights the computational challenges associated with large integers.

Who May Find This Useful

This discussion may be of interest to those studying number theory, algorithm design, or anyone looking to understand the complexities of integer factorization.

Eus
Messages
93
Reaction score
0
Hi Ho!

It is easy to observe that to get all factors of an integer n, one does not need to try whether a divides n for 1 < a < n.

But, rather using the following observation:
Suppose n is 24, then
24 / 1 = 24
24 / 2 = 12
24 / 3 = 8
24 / 4 = 6
-------------(!)
24 / 6 = 4
24 / 8 = 3
24 / 12 = 2
24 / 24 = 1

Notice that after (!), the divisor and the result of each probing step are just the swap of the divisor and the result of each probing step before (!). With other words, (!) acts as a mirror. Therefore, to find all factors of an integer n, one only needs to record both the divisor and the result of each probing step until the first swap happens, or until the values of the divisor and the result are the same such as when n = 49.

We know that, to test whether an integer number n is prime or not, one only needs to try to divide n by an integer from 2 until square root of n. Is it possible to predict before hand at what n-th factor the mirroring will occur?

Thanks.

Regards,
Eus
 
Physics news on Phys.org
The mirror occurs at half way >.< Whilst the square root occurs earlier, which is why we use that observation instead.
 
Eus: if you can factor your number as

[itex]N = A \times B[/itex] (with [itex]A \leq B[/itex])

then it is well known that [itex]A \leq \sqrt{N} \leq B[/itex].
 
Suppose you can check divisibility in 10 ns. Then factoring a number by checking sequential numbers takes

10 digits:
1 minute (N/2)
1 ms (sqrt(N))

16 digits:
1.5 years (N/2)
1 second (sqrt(N))

20 digits:
15 millennia (N/2)
2 minutes (sqrt(N))

Of course good factoring methods are much better. Pari, which isn't really all that fast in general, factored the random 20-digit semiprime 42731646881968660727 in 156 ms. For larger numbers the difference is more pronounced: for 30 digits, the sqrt method would take 4 months while Pari took 516 ms (for 9981479919456039576778843766369589135143).
 
Hi Ho!

Thank you for all of the replies, especially, CRGreathouse for giving me information on PARI/GP.

What I can conclude is that there is no quick way to determine the number of factors that an integer number has.

If suppose there is a function [tex]f(n)[/tex] that can give us the number of factors of an integer number [tex]n[/tex], then we know that the mirroring will occur after we get the [tex](\left\lceil\frac{f(n)}{2}\right\rceil)[/tex]-th factor.

But, there is no such a function, right?


Eus
 
Of course there is such a function, you just defined it.
 
Eus said:
If suppose there is a function [tex]f(n)[/tex] that can give us the number of factors of an integer number [tex]n[/tex], then we know that the mirroring will occur after we get the [tex](\left\lceil\frac{f(n)}{2}\right\rceil)[/tex]-th factor.

Suppose [tex]N=n_1^{a_1}\cdot n_2^{a_2}\cdots n_k^{a_k}[/tex].

Then [itex]\omega(n)=k[/itex], [itex]\Omega(n)=a_1+a_2+\cdots+a_k[/itex], and [itex]\sigma_0(n)=(a_1+1)(a_2+1)\cdots(a_k+1)[/itex]. There are three standard functions that count factors: distinct prime factors, indistinct prime factors, and total factors.

The mirroring point you're looking for happens at the square root. Notice that in your example, [itex]\sqrt{24}\approx4.9[/itex] and the mirror is between 4 and 6.
 
The OP wants a way to compute the exact number (in the case of 24, it would be 4) beyond which you don't need to check anything.

I would be surprised if this was easy to do. I'd expect it would be faster to just bite the bullet and go on up to the square root.
 
Xevarion said:
The OP wants a way to compute the exact number (in the case of 24, it would be 4) beyond which you don't need to check anything.

I would be surprised if this was easy to do. I'd expect it would be faster to just bite the bullet and go on up to the square root.

You can take L = the lcm of the factors you find so far, and then you only need to check up to floor(sqrt(N / L)). Of course when you look at the process as factoring rather than finding divisors this is obvious.
 
  • #10
CRGreathouse said:
Suppose [tex]N=n_1^{a_1}\cdot n_2^{a_2}\cdots n_k^{a_k}[/tex].

Then [itex]\omega(n)=k[/itex], [itex]\Omega(n)=a_1+a_2+\cdots+a_k[/itex], and [itex]\sigma_0(n)=(a_1+1)(a_2+1)\cdots(a_k+1)[/itex]. There are three standard functions that count factors: distinct prime factors, indistinct prime factors, and total factors.

The mirroring point you're looking for happens at the square root. Notice that in your example, [itex]\sqrt{24}\approx4.9[/itex] and the mirror is between 4 and 6.

Thank you very much for pointing out that the mirroring will happen approximately after finding the ([itex]\sqrt{n}[/itex])-th factor. This way I can determine the worst running time of such an algorithm and the memory space needed to contain all of factors of an integer number [itex]n[/itex].

Moreover, you also mentioned three interesting functions.
If [itex]N=24[/itex] then [itex]24=2^{3}\cdot 3^{1}[/itex]. So, [itex]\omega(24)=4[/itex], [itex]\Omega(24)=4[/itex], and [itex]\sigma_0(24)=8[/itex].
The number of indistinct prime factors is 4. How do you define indistinct prime factors?
Do you mean that they are [itex]4, 6, 8, 12[/itex] for [itex]N=12[/itex]?

I don't get what you mean below. Isn't that [itex]\sqrt{N}[/itex] is all that counts? I would be glad if you could explain further.
CRGreathouse said:
You can take L = the lcm of the factors you find so far, and then you only need to check up to floor(sqrt(N / L)).

Thank you very much.

Regards,
Eus
 
Last edited:
  • #11
Eus said:
How do you define indistinct prime factors?
Do you mean that they are [itex]4, 6, 8, 12[/itex] for [itex]N=12[/itex]?

4, 6, 8, and 12 are all composite (none are prime), so I don't call them indistinct prime factors. Consider the prime factors of 12 = 2 x 2 x 3. It has three prime factors, (2, 2, 3), but only two distinct prime factors, {2, 3}. So [itex]\omega(12)=2[/itex] but [itex]\Omega(12)=3[/itex].

[tex]\omega(1024) = 1, \Omega(1024) = 10[/tex] since 1024 = 2^10.
 
  • #12
Eus said:
Thank you very much for pointing out that the mirroring will happen approximately after finding the ([itex]\sqrt{n}[/itex])-th factor. This way I can determine the worst running time of such an algorithm and the memory space needed to contain all of factors of an integer number [itex]n[/itex].

The mirror is at sqrt(n), not the sqrt(n)th factor. You can always stop factoring at the square root of the number you're on; all divisors above sqrt(n) can be found by dividing n by the smaller divisors.

This is easy to see: if k > sqrt(n), and h > sqrt(n), then k * h > sqrt(n) * sqrt(n) = n and so h * k is not a factor of n.
 
Last edited:

Similar threads

  • · Replies 27 ·
Replies
27
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 55 ·
2
Replies
55
Views
7K