Project Euler 211 - Divisor Square Sum
Official link: https://projecteuler.net/problem=211
Note: My code takes around ~600s, only ~24 seconds with pypy
Official link: https://projecteuler.net/problem=211
Note: My code takes around ~600s, only ~24 seconds with pypy
Just a bit lazy on this problem, at first I tried to be smart using the divisor function, but it was pretty slow, so I just opted for a simple array on length 64,000,000 where every value is 1 (Because 1 is a divisor of every number)
Then I just go through all numbers, x, 2 ≤ x ≤ 64,000,000, and for each multiple of x less than 64,000,000 I add x*x to its array position (array[i*x] += x*x)
At the end I just check which values in the array are square numbers and sum them up, nothing special, code takes about 10 mins to fully run.
Input an integer (yourinput)
Code will output sum of all n, 0 < n < yourinput such that σ2(n) is a perfect square