with(numtheory); a := 142111; n := 56333333333333333333; b := a&^(n-1) mod n; ithprime(100000);