That's a prime... almost
Pyth, 9 bytes
e.fqlPZQE
Explanation
- autoassign Q = eval(input())
PZ - prime_factors(Z)
l - len(^)
q Q - ^ == Q
.f E - first eval(input()) of (^ for Z in range(inf))
e - ^[-1]
Try it here!
Or try a test suite!
Brachylog, 9 bytes
Beating @sundar by using half as much bytes
{~l~ḋ}ᶠ⁽t
Explanation
-- Input like [n,k]
{ }ᶠ⁽ -- Find the first n values which
~ḋ -- have a prime decomposition
~l -- of length k
t -- and take the last one
Try it online!
Jelly, 9 bytes
ÆfL=³
ç#Ṫ
Try it online!
How it works
Ç#Ṫ Main link. Left input: k. Right input: n.
Ç Apply the helper link to k, k + 1, k + 2, ... until...
# n matches are found.
Ṫ Retrieve the last match.
ÆfL=³ Helper link. Left argument: k (iterator)
Æf Yield the prime factors of k.
L Compute the length of the list, i.e., the number of prime factors.
=³ Compare the result with k (left input).