A   k-Almost-prime   is a natural number   



n


{\displaystyle n}

   that is the product of   



k


{\displaystyle k}

   (possibly identical) primes.



Example

1-almost-primes,   where   



k
=
1


{\displaystyle k=1}

,   are the prime numbers themselves.

2-almost-primes,   where   



k
=
2


{\displaystyle k=2}

,   are the   semiprimes.



Task

Write a function/method/subroutine/... that generates k-almost primes and use it to create a table here of the first ten members of k-Almost primes for   



1
<=
K
<=
5


{\displaystyle 1<=K<=5}

.



Related tasks

   Semiprime
   Category:Prime Numbers


100H:
BDOS: PROCEDURE (FN, ARG); DECLARE FN BYTE, ARG ADDRESS; GO TO 5; END BDOS;
EXIT: PROCEDURE; CALL BDOS(0,0); END EXIT;
PRINT: PROCEDURE (S); DECLARE S ADDRESS; CALL BDOS(9,S); END PRINT;
 
PRINT$NUMBER: PROCEDURE (N);
    DECLARE S (4) BYTE INITIAL ('...$');
    DECLARE P ADDRESS, (N, C BASED P) BYTE;
    P = .S(3);
DIGIT:
    P = P - 1;
    C = N MOD 10 + '0';
    N = N / 10;
    IF N > 0 THEN GO TO DIGIT;
    CALL PRINT(P);
END PRINT$NUMBER;
 
KPRIME: PROCEDURE (N, K) BYTE;
    DECLARE (N, K, P, F) BYTE;
    F = 0;
    P = 2;
    DO WHILE F < K AND P*P <= N;
        DO WHILE N MOD P = 0;
            N = N/P;
            F = F+1;
        END;
        P = P+1;
    END;
    IF N > 1 THEN F = F + 1;
    RETURN F = K;
END KPRIME;
 
DECLARE (I, C, K) BYTE;
DO K=1 TO 5;
    CALL PRINT(.'K = $');
    CALL PRINT$NUMBER(K);
    CALL PRINT(.':$');
 
    C = 0;
    I = 2;
    DO WHILE C < 10;
        IF KPRIME(I, K) THEN DO;
            CALL PRINT(.' $');
            CALL PRINT$NUMBER(I);
            C = C+1;
        END;
        I = I+1;
    END;
    CALL PRINT(.(13,10,'$'));
END;
CALL EXIT;
EOF