Skip to content

Commit 2c70f69

Browse files
ECM montgomery and edwards, torsion 8 and 16
1 parent 52caf9b commit 2c70f69

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -211,29 +211,34 @@ ECM on Mersenne numbers
211211
------------------------
212212
ECM is a probabilistic generalization of P−1/P+1: it succeeds when the group order on a random curve has a cofactor that’s B1,B2-smooth, so B1/B2 should be chosen for the target factor size.
213213
214-
ECM on Mersenne numbers N = 2^p - 1. Stage 1 multiplies by all prime powers <= B1; Stage 2 scans primes in (B1, B2]. Without flags you get the plain prime-by-prime Stage 2. "-brent d" enables a simplified Brent-Suyama extension by using q^d (a bit more extra reach beyond B2). "-bsgs" batches several multipliers into one ladder call to reduce overhead. Both flags are complementary and can be combined. You can pass pre-known factors via "-factors <list>" (decimal or 0x hex); they are divided out (with multiplicities) before ECM. For p=701, 796337 is a known factor. Runs are checkpointed periodically; re-running the same command resumes safely.
215-
```
216-
# Plain ECM on M_p (here p=701)
217-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8
218-
219-
# ECM + batching only (same primes, fewer ladder calls)
220-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8 -bsgs
221-
222-
# ECM + simplified Brent-Suyama only (q -> q^3 here)
223-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8 -brent 3
224-
225-
# ECM + both (complementary: q -> q^3 and batched multipliers)
226-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8 -brent 3 -bsgs
227-
228-
# Provide known factors (e.g., for p=701, factor 796337)
229-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8 -factors 796337
230-
231-
# Combine known factors with brent+bsgs
232-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8 -brent 3 -bsgs -factors 796337
233-
234-
# Resume after interrupt (same command; auto-checkpointed)
235-
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8 -brent 3 -bsgs -factors 796337
236-
```
214+
ECM on Mersenne numbers
215+
-----------------------
216+
ECM on N = 2^p - 1.
217+
218+
Curve model and torsion:
219+
- default: Edwards, torsion 8
220+
- -montgomery: use Montgomery model
221+
- -torsion16: force torsion 16
222+
- -notorsion: no torsion
223+
224+
Outputs:
225+
- results append to ecm_result.json
226+
- last curve saved to lastcurve.gp (PARI/GP)
227+
- checkpoints auto-resume on re-run
228+
229+
Examples:
230+
# Stage-1 only
231+
./prmers 701 -ecm -b1 6000 -K 8
232+
233+
# Enable Stage-2
234+
./prmers 701 -ecm -b1 6000 -b2 33333 -K 8
235+
236+
# Model / torsion variants
237+
./prmers 701 -ecm -b1 6000 -K 8 -montgomery
238+
./prmers 701 -ecm -b1 6000 -K 8 -torsion16
239+
./prmers 701 -ecm -b1 6000 -K 8 -notorsion
240+
./prmers 701 -ecm -b1 6000 -K 8 -montgomery -torsion16
241+
./prmers 701 -ecm -b1 6000 -K 8 -montgomery -notorsion
237242
238243
239244
## GPU Memory Test (`-memtest`)

src/io/CliParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ void printUsage(const char* progName) {
8585
std::cout << " -montgomery : (Optional) use Montgomery instead of twisted Edwards curve" << std::endl;
8686
std::cout << " -torsion16 : (Optional) use torsion-16 instead of default torsion-8" << std::endl;
8787
std::cout << " -notorsion : (Optional) use no torsion instead of default torsion-8" << std::endl;
88-
std::cout << " -brent [<d>] : (Optional) use Brent-Suyama variant with default or specified degree d (e.g., -brent 6)" << std::endl;
89-
std::cout << " -bsgs : (Optional) enable batching of multipliers in ECM stage 2 to reduce ladder calls" << std::endl;
88+
//std::cout << " -brent [<d>] : (Optional) use Brent-Suyama variant with default or specified degree d (e.g., -brent 6)" << std::endl;
89+
//std::cout << " -bsgs : (Optional) enable batching of multipliers in ECM stage 2 to reduce ladder calls" << std::endl;
9090
std::cout << " -marin : (Optional) deactivate use of marin backend" << std::endl;
9191
std::cout << " -resume : (Optional) write GMP-ECM and Prime 95 resume file after P-1 stage 1" << std::endl;
9292
//std::cout << " -p95 : (Optional) write Prime 95 resume file after P-1 stage 1" << std::endl;

0 commit comments

Comments
 (0)