image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

Go Back   Physics Forums > Mathematics > Number Theory


Reply

image Average minimum tries for prime factorization Share It Thread Tools Search this Thread image
Old May24-09, 06:24 PM                  #1
Loren Booda
 
Loren Booda's Avatar

Loren Booda is Offline:
Posts: 3,126
Recognitions:
PF Contributor PF Contributor
Average minimum tries for prime factorization

On average, at least how many factors must one try dividing a number N by to decompose it into primes?
  Reply With Quote
Old May24-09, 07:04 PM       Last edited by CRGreathouse; May25-09 at 01:57 AM..            #2
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Average minimum tries for prime factorization

Originally Posted by Loren Booda View Post
On average, at least how many factors must one try dividing a number N by to decompose it into primes?
If you are dividing by sequential primes starting from 2, and you test the cofactor with a primality test after you find each factor, you're asking about the distribution of the second-smallest prime factor of a random integer. In particular, you want the number of primes up to that number.

A good answer would involve the extended Dickman function; see
http://cr.yp.to/bib/1996/bach-semismooth.pdf

An easier answer would involve harmonic numbers, since the 'probability' of finding an n-bit factor in a large number is about 1/n.

An off-the-cuff estimate would be "around n^(1/4) to n^(1/3)".
  Reply With Quote
Old May25-09, 01:57 AM                  #3
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Average minimum tries for prime factorization

I'm not entirely sure about this, but I hacked together a program to calculate this for you based on the paper cited above. It suggests that the average size (median exponent) of the second-largest prime factor of a random integer N is around N^0.282.
  Reply With Quote
Old May25-09, 02:55 PM                  #4
Loren Booda
 
Loren Booda's Avatar

Loren Booda is Offline:
Posts: 3,126
Recognitions:
PF Contributor PF Contributor
Re: Average minimum tries for prime factorization

Originally Posted by CRGreathouse View Post
...you're asking about the distribution of the second-smallest prime factor of a random integer. In particular, you want the number of primes up to that number.
Bravo! - but why the second-smallest in particular? Could you give me an example of this result?

Thanks much for the computation also. I guess it is based on a prime approximation formula.
  Reply With Quote
Old May26-09, 02:03 AM                  #5
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Average minimum tries for prime factorization

Originally Posted by Loren Booda View Post
Bravo! - but why the second-smallest in particular? Could you give me an example of this result?
I'm not sure how to explain; it's obvious to me.

Let's say you have n = p * q * ... * r * s. You find the factor s, but n/s is still composite. You find the factor r, but n/ (r * s) is still composite. Then you find a number of other factors, but the cofactor is still composite. Then you find the factor q, and n / (s * r * ... * q) is prime, so you stop factoring. The last prime you had to factor out is the second-smallest.

Originally Posted by Loren Booda View Post
Thanks much for the computation also. I guess it is based on a prime approximation formula.
It was a very hairy calculation using numerical root-finding, table lookup, a complicated approximation function, and more. It used the extension of Dickman's function from the paper I linked to.

There were so many steps in the process I'm not sure the result is correct! I may have made a mistake along the way. But it seems to be in about the right range, so I'm reasonably sure I have it.
  Reply With Quote
Old May26-09, 10:30 PM                  #6
Loren Booda
 
Loren Booda's Avatar

Loren Booda is Offline:
Posts: 3,126
Recognitions:
PF Contributor PF Contributor
Re: Average minimum tries for prime factorization

Your first approximation is really on the cuff. Can you tell how you conceived it?

Thank you for explaining your initial response in more detail. The distribution now seems sensible to me.

You prove yourself to be quite an adept and patient mathematician. The praise here belongs to you.
  Reply With Quote
Old May27-09, 12:07 AM                  #7
CRGreathouse

CRGreathouse is Offline:
Posts: 2,939
Recognitions:
Homework Helper Homework Helper
Science Advisor Science Advisor
Re: Average minimum tries for prime factorization

Originally Posted by Loren Booda View Post
Your first approximation is really on the cuff. Can you tell how you conceived it?
My guess that the second factor was between the fourth and third root, on average, was simply a result of experience with factoring numbers. There was no math involved there.

The n^0.282 approximation was based on the Bach-Peralta asymptotic formula G, which I hope I implemented properly. It's complicated.
  Reply With Quote
image image
Reply
Thread Tools


Similar Threads for: Average minimum tries for prime factorization
Thread Thread Starter Forum Replies Last Post
Algorithm for prime factorization saadsarfraz Calculus & Beyond 12 Jan28-09 03:16 PM
Prime factorization of rationals Dodo Number Theory 4 Jul6-08 07:57 PM
Prime factorization set: Zeth Set Theory, Logic, Probability, Statistics 2 Aug2-07 10:16 AM
Prime factorization, Exponents turdferguson Precalculus Mathematics 1 Mar25-07 03:45 PM
Prime factorization devious_ Number Theory 2 Oct27-04 02:57 PM

Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. © 2009 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image