def test(a, p): E.params(a, -a, p) s = set() e = E(1, 1) + E(1, 1) cnt = 1 while e.P != (1, 1): e = e + E(1, 1) cnt = cnt + 1 print(cnt)
def test(a, p, target): E.params(a, -a, p) s = set() e = E(1, 1) + E(1, 1) cnt = 1 while e.P != (1, 1): e = e + E(1, 1) cnt = cnt + 1 return cnt == target
def check(p): a = 1 E.params(a, -a, p) while True: a += 1 E.params(a, -a, p) if doubleAndAdd(E(1, 1), 1000000) == E(0): print(a) if order(a) == 1000000: return a
def fastMult(e, poww): res = E(0) z = e while (poww > 0): res = res + (poww % 2) * z poww = poww // 2 z = z + z return res if __name__ == '__main__': p = 36028797018964019 q = 36028796930959053 a = 12730951283832694 E.params(a, -a, p) s = 788139760620004 e = 57233552642126 s1 = fastMult(E(1, 1), e).P[0] d = 8675309 s2 = ((d + s * s1) * inv(e, q)) % q print fastMult(E(1, 1), q) print fastMult(E(1, 1), s) print s1 print s2
from ec import E p = 977245356317 ph = 977244806323 def fastMult(e, poww): res = E(0) z = e while(poww > 0): res = res + (poww%2)*z poww = poww//2 z = z + z return res if __name__ == '__main__': E.params(454619944748, 67189121909, p) P = E(474177197796,218937542115) Q = E(287274742986,103070012816) print(fastMult(P, 777244806324)) E.params(508139, -508139, 900001) print(fastMult(E(1, 1), 10000))