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


            NORMAL MODE IS INTEGER
 
            INTERNAL FUNCTION(NN,KK)
            ENTRY TO KPRIME.
            F = 0
            N = NN
            THROUGH SCAN, FOR P=2, 1, F.GE.KK .OR. P*P.G.N
DIV         WHENEVER N.E.N/P*P
                N = N/P
                F = F+1
                TRANSFER TO DIV
            END OF CONDITIONAL
SCAN        CONTINUE
            WHENEVER N.G.1, F = F+1
            FUNCTION RETURN F.E.KK
            END OF FUNCTION
 
            VECTOR VALUES KFMT = $5(S1,2HK=,I1,S1)*$
            VECTOR VALUES PFMT = $5(I4,S1)*$            
            PRINT FORMAT KFMT, 1, 2, 3, 4, 5
 
            DIMENSION KPR(50)            
            THROUGH FNDKPR, FOR K=1, 1, K.G.5
            C=0
            THROUGH FNDKPR, FOR I=2, 1, C.GE.10
            WHENEVER KPRIME.(I,K)
                KPR(C*5+K) = I
                C = C+1
            END OF CONDITIONAL
FNDKPR      CONTINUE
 
            THROUGH OUT, FOR C=0, 1, C.GE.10
OUT         PRINT FORMAT PFMT, KPR(C*5+1), KPR(C*5+2), KPR(C*5+3),
          0                    KPR(C*5+4), KPR(C*5+5)
 
            END OF PROGRAM 