• prime_number_314159@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    24 hours ago

    If small numbers are much more frequent, it’s better to return early. Really, you should gather statistics about the numbers the function is called with, and put the most frequent ones at the top.