Skip to content

Instantly share code, notes, and snippets.

@sponege
Created April 23, 2020 22:47
Show Gist options
  • Save sponege/5c66505819d093c71a2da4a21f1da944 to your computer and use it in GitHub Desktop.
Save sponege/5c66505819d093c71a2da4a21f1da944 to your computer and use it in GitHub Desktop.
print()
print("g * d ≡ 1 mod p")
print("Give me g and p, I will calculate d for you.")
print()
g = int(input("g: "))
p = int(input("p: "))
d = 1
while d % g != 0:
d += p
d = int(d / g)
print("d:", d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment