A number is an   attractive number   if the number of its prime factors (whether distinct or not) is also prime.



Example

The number   20,   whose prime decomposition is   2 × 2 × 5,   is an   attractive number   because the number of its prime factors   (3)   is also prime.



Task

Show sequence items up to   120.



Reference

   The OEIS entry:   A063989: Numbers with a prime number of prime divisors.


func IsPrime(N);        \Return 'true' if N is prime
int  N, I;
[if N <= 2 then return N = 2;
if (N&1) = 0 then \even >2\ return false;
for I:= 3 to sqrt(N) do
    [if rem(N/I) = 0 then return false;
    I:= I+1;
    ];
return true;
];
 
func Factors(N);        \Return number of factors for N
int  N, Cnt, F;
[Cnt:= 0;
F:= 2;
repeat  if rem(N/F) = 0 then
                [Cnt:= Cnt+1;
                N:= N/F;
                ]
        else    F:= F+1;
until   F > N;
return Cnt;
];
 
int C, N;
[C:= 0;
for N:= 4 to 120 do
    if IsPrime(Factors(N)) then
        [IntOut(0, N);
        C:= C+1;
        if rem(C/10) then ChOut(0, 9\tab\) else CrLf(0);
        ];
]