1. if x is congruent 0 then YES
2. otherwise, calculate if [x^((p-1)/gcd(k,p-1))] % p is 1.
