资源简介
ECM被认为是一种特殊用途的保理算法,因为它最适合寻找小因素。目前,它仍然是不超过50至60 位数的除数的最佳算法,因为其运行时间由最小因子p的大小决定,而不是由要被考虑的数n的大小决定。通常,ECM用于从具有许多因素的非常大的整数中去除小因素; 如果剩余的整数仍然是复合的,那么它只有很大的因素,并且使用通用技术来分解。迄今为止使用ECM发现的最大因素有83位十进制数字,并于2013年9月7日由R. Propper发现。[1]增加测试曲线的数量可以提高找到因子的几率,但它们与数字数量的增加不成线性关系。
代码片段和文件信息
// Elliptic Curve Method (ECM) Prime Factorization
//
// Written by Dario Alejandro Alpern (Buenos Aires - Argentina)
// Last updated August 22nd 2010. See http://www.alpertron.com.ar/ECM.HTM
//
// based in Yuji Kida‘s implementation for UBASIC interpreter
//
// No part of this code can be used for commercial purposes without
// the written consent from the author. Otherwise it can be used freely
// except that you have to write somewhere in the code this header.
//
package ecm;
import java.applet.applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.URL;
public class ECM extends applet implements Runnable {
static final long serialVersionUID = 20L;
static final boolean KARATSUBA_ENABLED = false;
static final boolean debugging_main = true;
boolean onlyFactoring = true;
static final int ACTION_TEXT_NBR = 1;
static final int ACTION_TEXT_CURVE = 2;
static final int ACTION_BTN_CURVE = 3;
static final int ACTION_TEXT_FACTOR = 4;
static final int ACTION_BTN_FACTOR = 5;
static final int TYP_AURIF = 100000000;
static final int TYP_TABLE = 150000000;
static final int TYP_SIQS = 200000000;
static final int TYP_LEHMAN = 250000000;
static final int TYP_EC = 300000000;
int digitsInGroup = 6;
int numberThreads = 1;
boolean forcedECM = false;
final BigInteger SS[] = new BigInteger[4000]; // For intermediate factors
final BigInteger PD[] = new BigInteger[4000]; // and prime factors
boolean numberIsNegative;
private final int Exp[] = new int[4000];
private final int Typ[] = new int[4000];
final BigInteger PD1[] = new BigInteger[4000];
final int Exp1[] = new int[4000];
final int Typ1[] = new int[4000];
String inputStr;
boolean foundByLehman;
boolean performLehman;
static final BigInteger BigInt0 = BigInteger.valueOf(0L);
static final BigInteger BigInt1 = BigInteger.valueOf(1L);
static final BigInteger BigInt2 = BigInteger.valueOf(2L);
static final BigInteger BigInt3 = BigInteger.valueOf(3L);
static final int PWmax = 32 Qmax = 30241 LEVELmax = 11;
static final int NLen = 1200;
final int aiIndx[] = new int[Qmax];
final int aiF[] = new int[Qmax];
static final int aiP[] = {2 3 5 7 11 13};
static final int aiQ[] =
{
2
3
5
7
13
11
31
61
19
37
181
29
43
71
127
211
421
631
41
73
281
2521
17
113
241
337
1009
109
271
379
433
541
757
2161
7561
15121
23
67
89
199
331
397
463
617
661
881
991
1321
2311
2377
2971
3697
评论
共有 条评论