UVa 113
From Algorithmist
Contents |
[edit] 113 - Power of Crytography
[edit] Summary
Given p and n, calculate
. We can solve this by using Logarithms.
[edit] Explanation
Recall that in Logarithms:
kn = p
is equivalent to
lnkn = lnp
which is simply
nlnk = lnp
or
thus k is:
[edit] Notes
- Double should be enough.
[edit] Input
2 16 3 27 7 4357186184021382204544
[edit] Output
4 3 1234

