While (1) { last if Math::BigInt::bgcd($k, $p_minus1) == 1; k++; }