attractivenumbers := proc(n::posint) local an, i; an :=[]: for i from 1 to n do if isprime(NumberTheory:-NumberOfPrimeFactors(i)) then an := [op(an), i]: end if: end do: end proc: attractivenumbers(120);