mathematica 发表于 2020-8-29 09:28:12

Windows7上使用GMP-ECM体验

下载地址:

https://mersenneforum.org/showpost.php?p=480484&postcount=455


常用命令:

::打开cmd窗口,输入下面的命令
::必须切换到这个目录下,不然调用不了命令
::目录下必须含有下面两个exe文件 ecm.exe ecmfactor.exe README
cd C:\Users\Administrator\Desktop\_123\gmpecm-svn3027-sandybridge
::全部帮助文件命令ecm --help
::1000条曲线,B1=1e6,B2=1e9,分解的整数在composites文件里
ecm -c 1000 1e6 1e9 < composites
::找到一个因子就停止运行
ecm -one -c 1000 1e6 1e9 < composites


全部帮助文件:Usage: ecm B1 [B2] < file

Parameters:
B1         stage 1 bound
B2         stage 2 bound (or interval B2min-B2max)

Options:
-x0 x      use x as initial point
-y0 y      use y as initial point (Weierstrass form)
-param i   which parametrization should be used
-sigma s   use s as parameter to compute curve's coefficients
               can use -sigma i:s to specify -param i at the same time
-A A         use A as a curve coefficient
-torsion T   to generate a curve with torsion group T
-k n         perform >= n steps in stage 2
-power n   use x^n for Brent-Suyama's extension
-dickson n   use n-th Dickson's polynomial for Brent-Suyama's extension
-c n         perform n runs for each input
-pm1         perform P-1 instead of ECM
-pp1         perform P+1 instead of ECM
-q         quiet mode
-v         verbose mode
-timestamp   print a time stamp with each number
-mpzmod      use GMP's mpz_mod for modular reduction
-modmuln   use Montgomery's MODMULN for modular reduction
-redc      use Montgomery's REDC for modular reduction
-nobase2   disable special base-2 code
-nobase2s2   disable special base-2 code in ecm stage 2 only
-base2 n   force base 2 mode with 2^n+1 (n>0) or 2^|n|-1 (n<0)
-ntt         enable NTT convolution routines in stage 2
-no-ntt      disable NTT convolution routines in stage 2
-save file   save residues at end of stage 1 to file
-savea filelike -save, appends to existing files
-resume file resume residues from file, reads from stdin if file is "-"
-chkpnt file save periodic checkpoints during stage 1 to file (for -param 0)
-primetest   perform a primality test on input
-treefile f store stage 2 data in files f.0, ...
-maxmem n    use at most n MB of memory in stage 2
-stage1time n add n seconds to ECM stage 1 time (for expected time est.)
-I f         increment B1 by f*sqrt(B1) on each run
-inp file    Use file as input (instead of redirecting stdin)
-one         Stop processing a candidate if a factor is found (looping mode)
-go val      Preload with group order val, which can be a simple expression,
               or can use N as a placeholder for the number being factored.
-printconfig Print compile-time configuration and exit.
-bsaves file With -param 1-3, save stage 1 exponent in file.
-bloads file With -param 1-3, load stage 1 exponent from file.
-h, --help   Prints this help and exit.


唯一的恼人的问题就是,一旦出现一个因子,但是不能够输出因子到文本文件里面(也许是我不会)

分享一下截屏


mathematica 发表于 2020-8-29 09:41:17

椭圆曲线分解整数,感觉还是命令行的方式可以操控的办法多,gui的方式,操控的太有限了,
命令行的复制粘贴真是简单!可以重复利用

.·.·. 发表于 2020-8-29 13:25:09

mathematica 发表于 2020-8-29 09:41
椭圆曲线分解整数,感觉还是命令行的方式可以操控的办法多,gui的方式,操控的太有限了,
命令行的复制粘 ...

我知道linux里面可以管道送到grep里面然后输出
windows里面应该可以有类似的操作

mathematica 发表于 2020-8-29 13:35:33

.·.·. 发表于 2020-8-29 13:25
我知道linux里面可以管道送到grep里面然后输出
windows里面应该可以有类似的操作

那你怎么弄的?怎么不写出来?

.·.·. 发表于 2020-8-29 13:41:46

mathematica 发表于 2020-8-29 13:35
那你怎么弄的?怎么不写出来?

ecm ... | grep Found > output.txt(不会打印输出到标准输出)
我不写的原因是我没有ECM

mathematica 发表于 2020-8-29 14:17:37

.·.·. 发表于 2020-8-29 13:41
ecm ... | grep Found > output.txt(不会打印输出到标准输出)
我不写的原因是我没有ECM

受你的启发,我学会了下面的方式!
ecm -one -c 1000 1e6 1e9 < composites | findstr "." >>output

mathematica 发表于 2020-8-29 14:19:25

.·.·. 发表于 2020-8-29 13:41
ecm ... | grep Found > output.txt(不会打印输出到标准输出)
我不写的原因是我没有ECM

你真聪明,居然会用管道!

mathematica 发表于 2020-8-29 16:00:02

.·.·. 发表于 2020-8-29 13:41
ecm ... | grep Found > output.txt(不会打印输出到标准输出)
我不写的原因是我没有ECM

难道你到现在都没有玩gmp ecm?

mathematica 发表于 2020-8-30 12:15:39

.·.·. 发表于 2020-8-29 13:41
ecm ... | grep Found > output.txt(不会打印输出到标准输出)
我不写的原因是我没有ECM

cd C:\Users\Administrator\Desktop\_123\gmpecm-svn3027-sandybridge
echo "(2^599-1)" | ecm -sigma 1604840403 3e6

求这个因子,算简单的,得到因子
148296291984475077955727317447564721950969097

mathematica 发表于 2020-8-30 20:39:25

.·.·. 发表于 2020-8-29 13:41
ecm ... | grep Found > output.txt(不会打印输出到标准输出)
我不写的原因是我没有ECM

你对椭圆曲线不了解,知道了sigma之后,运算会减少很多,时间主要都浪费在找sigma上!
页: [1] 2
查看完整版本: Windows7上使用GMP-ECM体验