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


proc nonrec kprime(word n, k) bool:
    word f, p;
    f := 0;
    p := 2;
    while f < k and p*p <= n do
        while n%p = 0 do
            n := n/p;
            f := f+1
        od;
        p := p+1
    od;
    if n>1 then f+1 = k
    else f = k
    fi
corp
 
proc nonrec main() void:
    byte k, i, c;
    for k from 1 upto 5 do
        write("k = ", k:1, ":");
        i := 2;
        c := 0;
        while c < 10 do
            if kprime(i,k) then
                write(i:4);
                c := c+1
            fi;
            i := i+1
        od;
        writeln()
    od
corp