Joined June 2013
·

Nathan Lucas

Denver, CO
·
·
·

Posted to Prime Numbers with Python v2 over 1 year ago

I apologize I never replied back to this. I haven't been doing much coding in the past two years and I spaced all of this. You are correct, this was changed but never updated on here.

def baillie_psw(n, limit=100):
    if n == 2:
        return True

    if not n & 1:
        return False

    if n < 2 or is_square(n):
        return False

    if gcd(n, PRIMONIAL_31) > 1:
        return n in PRIMES_LE_31

    bound = min(limit, isqrt(n))
    for i in range(3, bound, 2):
        if not n % i:
            return False

    return strong_pseudoprime(n, 2) \
        and strong_pseudoprime(n, 3) \
        and strong_lucas_pseudoprime(n)

The use of if not n % i: works the same as if n % i == 0:

This is great.

The reason the guide does not work is because step three creates %SUBLIMEHOME% and step 4 calls %SUBLIMETEXT%. If you created a system variable named %SUBLIMEHOME% referencing your Sublime Text 2 install directory, then add %SUBLIME_HOME% to your %PATH% variable.

Achievements
244 Karma
19,298 Total ProTip Views