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


BYTE FUNC IsAlmostPrime(INT num BYTE k)
  INT f,p,v
 
  f=0 p=2 v=num
  WHILE f<k AND p*p<=num
  DO
    WHILE v MOD p=0
    DO
      v==/p f==+1
    OD
    p==+1
  OD
  IF v>1 THEN
    f==+1
  FI
  IF f=k THEN
    RETURN (1)
  FI
RETURN (0)
 
PROC Main()
  BYTE count,k
  INT i
 
  FOR k=1 TO 5
  DO
    PrintF("k=%B:",k)
    count=0 i=2
    WHILE count<10
    DO
      IF IsAlmostPrime(i,k) THEN
        PrintF(" %I",i)
        count==+1
      FI
      i==+1
    OD
    PutE()
  OD
RETURN