Count how many numbers are divisible by perfect numbers in a given range Given two arbitrary integers \$a\$ and \$b\$, count how many numbers are divisible by perfect numbers in that given range (\$a\$ and \$b\$ both are inclusive).

In mathematics, a perfect number is a positive integer that is the sum
of its proper positive divisors, that is, the sum of the positive
divisors excluding the number itself.Equivalently, a perfect number is
a number that is half the sum of all of its positive divisors
(including itself), or \$σ(n) = 2n\$.

Input:
1 100

Output:
18


Use stdin and stdout for Input/Output
Your code must handle big integers, so it is not good enough to hard-code a list of perfect numbers.
Shortest code wins
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.