summaryrefslogtreecommitdiff
path: root/math/discreteNthRoot.cpp
blob: 9249f73afe3d951368958039cab904ad7e73afb6 (plain)
1
2
3
4
5
ll root(ll a, ll b, ll m) {
	ll g = findPrimitive(m);
	ll c = dlog(powMod(g, a, m), b, m); //diskreter logarithmus
	return c < 0 ? -1 : powMod(g, c, m);
}