Re: JSH: Surrogate factoring, periodic behavior
- From: rossum <rossum48@xxxxxxxxxxxx>
- Date: Sat, 01 Sep 2007 11:34:29 +0100
On Sat, 01 Sep 2007 05:21:41 -0000, JSH <jstevh@xxxxxxxxx> wrote:
Factored trying 5 surrogates on the fifth surrogate using k=1 whereI ran my usual tests again on 500 random composite odd numbers that
the start was with n=7.
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.58 probes.
JSH average = 1635.83 probes.
Probe ratio = 1 : 215.752
Trial average = 118.52 probes.
Reverse average = 12.12 probes.
Random average = 727.79 probes.
500 trials, 0 misfactors found.
Average k's tried per factorisation: 1.000
Average n's tried per factorisation: 47.040
k was fixed at 1 and n was 7, 8, 9, ...
Part of the problem I've run into with comments about surrogate
factoring have been repeated claims it works only as good as trial
division, but hey, I programmed the damn thing.
Any chance of seeing your code?
Mine is below. It is Java. This is not compilable as-is because
there are a few external classes and functions that I use. They are
all pretty obvious.
// -- Begin Code --
// JSH method - August 07
static FactorData jshFactor(int target) {
FactorData retData = new FactorData();
retData.factor1 = 0;
retData.factor2 = 0;
retData.probeCount = 0;
int k = 1;
int n = 7;
while(true) {
// Surrogate to factor = 2k^2 + nT
long surrogate = Math.abs(2L * k * k + n * target);
ArrayList<Ipair> sFactors = allFactorPairs(surrogate);
++nCount;
// Try possible solutions
long g_1, g_2, trialFac;
for (int i = 0; i < sFactors.size(); ++i) {
g_1 = sFactors.get(i).first;
g_2 = sFactors.get(i).second;
// fac1, positive
trialFac = Maths.GCD(g_1 - k, target);
++retData.probeCount;
if (trialFac > 1 && trialFac < target) {
retData.factor1 = trialFac;
retData.factor2 = target / trialFac;
break;
} // end if
// fac1, negative
trialFac = Maths.GCD(-g_1 - k, target);
++retData.probeCount;
if (trialFac > 1 && trialFac < target) {
retData.factor1 = trialFac;
retData.factor2 = target / trialFac;
break;
} // end if
// fac2, positive
trialFac = Maths.GCD(g_2 - k, target);
++retData.probeCount;
if (trialFac > 1 && trialFac < target) {
retData.factor1 = trialFac;
retData.factor2 = target / trialFac;
break;
} // end if
// fac2, negative
trialFac = Maths.GCD(-g_2 - k, target);
++retData.probeCount;
if (trialFac > 1 && trialFac < target) {
retData.factor1 = trialFac;
retData.factor2 = target / trialFac;
break;
} // end if
} // end for
if (retData.factor1 != 0) { break; }
++n;
} // end while
return retData;
} // end jshFactor()
// -- End Code --
rossum
.
- Follow-Ups:
- Re: JSH: Surrogate factoring, periodic behavior
- From: Mas Plak
- Re: JSH: Surrogate factoring, periodic behavior
- From: JSH
- Re: JSH: Surrogate factoring, periodic behavior
- References:
- Re: JSH: Surrogate factoring, periodic behavior
- From: Enrico
- Re: JSH: Surrogate factoring, periodic behavior
- From: JSH
- Re: JSH: Surrogate factoring, periodic behavior
- Prev by Date: Re: Probability - Cryptography
- Next by Date: Re: The dimension of fixed space of a matrix
- Previous by thread: Re: JSH: Surrogate factoring, periodic behavior
- Next by thread: Re: JSH: Surrogate factoring, periodic behavior
- Index(es):