public static bool Pocklington(ulong n)
        {
            ulong[] primes = Sieve.Standard((ulong)System.Math.Log(n - 1)).Cast <ulong>().ToArray();
            ulong   f = n - 1, sqrt = (ulong)System.Math.Sqrt(n);

            foreach (ulong prime in primes)
            {
                if (f / prime < sqrt)
                {
                    goto g;
                }
                while (f % prime == 0)
                {
                    if (f / prime < sqrt)
                    {
                        goto g;
                    }
                    f /= prime;
                }
            }
g:
            var factors = Factorise.Standard(f, (z) => (ulong)Factoring.Special.TrialDivision((int)z));

            for (uint i = 2; i < n; i++)
            {
                if (Power.BinaryMod(i, n - 1, n) == 1)
                {
                    bool isPrime = true;
                    foreach (uint factor in factors)
                    {
                        if (GCD.Standard((uint)Power.Binary(i, (n - 1) / factor) - 1, n) != 1)
                        {
                            isPrime = false;
                            break;
                        }
                    }
                    if (isPrime)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }