commands → rootmod

rootmod(A,B,P)

The rootmod command solves A = X^B mod P for X, that is, it finds a Bth root of A modulo P. If no such root exists then null is returned.

Examples

# 3 = x^5 mod 13
rootmod(3,5,13);
	9

(9^5) % 13;
	3

Algorithm

This algorithm uses a brute force search.

References