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.


INCLUDE "H6:SIEVE.ACT"
 
BYTE FUNC IsAttractive(BYTE n BYTE ARRAY primes)
  BYTE count,f
 
  IF n<=1 THEN
    RETURN (0)
  ELSEIF primes(n) THEN
    RETURN (0)
  FI
 
  count=0 f=2
  DO
    IF n MOD f=0 THEN
      count==+1
      n==/f
      IF n=1 THEN
        EXIT
      ELSEIF primes(n) THEN
        f=n
      FI
    ELSEIF f>=3 THEN
      f==+2
    ELSE
      f=3
    FI
  OD
 
  IF primes(count) THEN
    RETURN (1)
  FI
RETURN (0)
 
PROC Main()
  DEFINE MAX="120"
  BYTE ARRAY primes(MAX+1)
  BYTE i
 
  Put(125) PutE() ;clear the screen
  Sieve(primes,MAX+1)
  PrintF("Attractive numbers in range 1..%B:%E",MAX)
  FOR i=1 TO MAX
  DO
    IF IsAttractive(i,primes) THEN
      PrintF("%B ",i)
    FI
  OD
RETURN