Project Euler 401 - Sum of squares of divisors

Official link:

Thought Process

An initial search of the first few terms gives the OEIS Sequence A064602 which leads to a formula that can be implemented in O(sqrt(n)) time, but I was more interested in proving why the formula works.

Interactive Code

Input an integer (yourinput)

Code will output SIGMA2(yourinput) mod 10^9