Re: Congruence based factoring algorithm, revised
- From: rossum <rossum48@xxxxxxxxxxxx>
- Date: Wed, 03 Dec 2008 16:28:06 +0000
On Tue, 2 Dec 2008 17:29:16 -0800 (PST), JSH <jstevh@xxxxxxxxx> wrote:
An initial presentation of a prior version of this algorithm had aYou could phrase this better, something like:
fatal error. The underlying equations are the same but I was using
them wrong. Here is the corrected algorithm.
It defies conventional wisdom by showing a congruence based factoring
method
"It is a congruence based factoring method ... "
that allows you to pick a large enough prime p, and solve forYou missed a trick here James. It is possible that p is a factor of T
f_1 and f_2, where f_1*f_2 = T, where T is the target composite to be
factored mod p.
With all positive integers, given a target composite T to be factored,
first find a prime number p greater than sqrt(T).
so you need to check that at this point. Indeed it is essential that
you check it, otherwise you will get into problems further on.
Then set a variableThis is where the problems with T mod p = 0 start. k = 0 is the only
I call 'a', to a=2 and calculate a variable I call k, with the
following congruence relationship:
k^2 = (1 + a^2)^{-1}(T) mod p.
solution.
Here I assume you mean "if k does not exist,".
where if it does not exist,
you increment 'a' by 1 and try again.More problems in the T mod p = 0 case. If k = 0 then f_1 = 0 and f_2
There is a 50% chance that any particular 'a' will work as there are
(p-1)/2 quadratic residues modulo p.
If you get a k then you check for a solution for f_1 and f_2,where
f_1*f_2 = T
with
f_1 = ak mod p and f_2 = a^{-1}(1 + a^2)k mod p.
= 0. Divide by zero errors do not make for a good algorithm when
coding it up on a computer.
As I read this, there are three possible factors to try: f_1, f_2 and
If ak is greater than p, and you've succeeded when you take ak modulo
p, you will have a factor of T. If it is less than p, see if a(p-k) is
greater than p, and check that mod p if it is. However, f_1 may be the
larger factor so also check f_2, as then it will give the smaller
factor exactly or p - f_2 will.
p - f_2. I try them in that order and stop after the first factor is
found.
The T mod p = 0 case uses the third factor, since p - 0 = p which is
indeed a factor of T. You could have got to it a lot earlier in your
algorithm if you had checked for it when picking p.
I would appreciate comments or criticisms on this approach and
apologize if it's not close to some standard form. I am cutting and
pasting from several sources.
James Harris
I coded James' algorithm, with the additional check for T mod p = 0
and an early exit.
As I have done previously, I tested James' latest factoring method on
500 random composite odd numbers that are multiples of two different
primes, each in the range 500 to 1000. The results are compared to
Fermat's method, trial factorisation (both forward and reverse) and
random picking.
Fermat average = 7.54 probes.
JSH average = 31.44 probes.
Probe ratio = 1 : 4.170
Trial average = 119.50 probes.
Reverse average = 11.91 probes.
Random average = 667.75 probes.
500 trials, 0 misfactors found.
Average a's tried per factorisation: 11.744
Average p's tried per factorisation: 7.078
Average a's tried per p: 1.659
Average k's tried per factorisation: 6.092
Average timings over 200 numbers:
16 bits: 15.840 mSec average per number. 0 misfactors.
18 bits: 35.557 mSec average per number. 0 misfactors.
20 bits: 89.864 mSec average per number. 0 misfactors.
22 bits: 269.572 mSec average per number. 0 misfactors.
24 bits: 698.010 mSec average per number. 0 misfactors.
As seems usual with James' methods it will factorise the target number
correctly, but has no speed advantage over existing methods. Judging
from the timing tests, this latest method does not scale well to
larger numbers.
rossum
.
- Follow-Ups:
- Re: Congruence based factoring algorithm, revised
- From: rossum
- Re: Congruence based factoring algorithm, revised
- Prev by Date: Re: Congruence based factoring algorithm, revised
- Next by Date: Re: Congruence based factoring algorithm, revised
- Previous by thread: Re: Congruence based factoring algorithm, revised
- Next by thread: Re: Congruence based factoring algorithm, revised
- Index(es):
Relevant Pages
|