Count how many numbers are divisible by perfect numbers in a given range
Mathematica - 117 

Naive approach, linear for the range size

With[{p=#(#+1)/2&amp;/@Select[2^Range@@Floor@Log2@Sqrt@#-1,PrimeQ]},Length@Select[Range@@#,Or@@Divisible[#,p]&amp;]]&amp;@Input[]


The correct way would be constructing numbers from the perfect numbers that are in the given range of course.