• Dave.@aussie.zone
    link
    fedilink
    arrow-up
    32
    ·
    edit-2
    8 months ago

    What your code can do is run this first and if it returns false then do a quick double check using a traditional isPrime function. Really speeds things up!

      • Dave.@aussie.zone
        link
        fedilink
        arrow-up
        5
        ·
        8 months ago

        Nah, you’ve always got to check the corner cases. It’s a variation on Murphy’s Law - you don’t encounter corner cases when you’re developing a program but corner cases are 99 percent of an everyday user’s interaction.