Maths Olympiad Prep

Library / /28 of 348

Number theory Difficulty 4.6 AIME Find the answer

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 XX and the actual value is YY, your score will be max(0,20801XY)\max \left(0,20-80\left|1-\frac{X}{Y}\right|\right) rounded to the nearest integer.

A number or a short expression. Spacing and $ signs are ignored.

Solution

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

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.