add challenge scripts

This commit is contained in:
2025-09-12 11:19:05 +02:00
parent 81fea4865e
commit 7f33c43169
10 changed files with 321 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
const p = 12345679943n;
function onClick() {
if(n >= 30000n) {
return;
}
n++;
x = log(42n, 1n + (x+n) % (p-1n), p);
}
function log(g, b, m) {
const s = Math.ceil(Number(m)**.5);
const r = new Map();
let a = b % m;
if(a == 1n) {
return 0n;
}
for(let i = 0; i < s; i++) {
r.set(a, i);
a *= g;
a %= m;
}
const gs = pow(g, BigInt(s), m);
a = gs;
for(let j = 1; j <= s; j++) {
const i = r.get(a);
if(i !== undefined) {
return BigInt(j*s-i);
}
a *= gs;
a %= m;
}
}