• [deleted]
    + 2 comments

    I found a more efficient implementation here for those performance geeks. (Prime factorization is even better, but probably overkill.)

    Note: Linked answer is slightly wrong, looks like they forgot to add the number itself to the sum. But you get the idea.