p = 16496037227337470707
a = 2020
b = 0
E = EllipticCurve(GF(p),[a,b]) #建立椭圆曲线E
g1 = E(1,12352989693655963935) #选择一点作为生成元
g2=E(3361984281888091942,9881897088122670838)
g3=(g1-g2)
k=3
kP=g3
# Compute the modular inverse of k
k_inv = inverse_mod(k, E.order()) # This assumes that k is non-zero and coprime to the order of the curve
# Now calculate P
P = k_inv * kP # This is how you retrieve the original point P
print("Recovered point P:", P)
print(3*P+g2==g1)
还是gpt老师厉害,虽然前两次回答都不靠谱。