HMMT-Nov 2016 guts, Problem 36

Find the number of positive integers less than 1000000 which are less than or equal to the sum of their proper divisors. If your answer is $X$ and the actual value is $Y$, your score will be $\max \left(0,20-80\left|1-\frac{X}{Y}\right|\right)$ rounded to the nearest integer.

Solution: $\mathrm{N}=1000000$ $\mathrm{s}=[0] * \mathrm{~N}$ ans $=0$ for $i$ in range $(1, N)$ : if $i<=s[i]$ : ans $+=1$ for $j$ in range( $i+i, N, i)$ : $s[j]+=i$ print(ans) $\fbox{247548}$.

Answer: 247548