| Bytes | Lang | Time | Link |
|---|---|---|---|
| 143 | Python 2 | 110517T215709Z | Keith Ra |
| 009 | Jelly | 210421T225303Z | caird co |
| 032 | J | 160320T003205Z | Gregory |
| 149 | JavaScript | 110517T225515Z | Ry- |
| nan | 110517T045512Z | st0le | |
| 170 | Java | 110516T130749Z | cubanaca |
Python 2, 143 bytes
R=range
P=[x for x in R(2,99)if all(x%i for i in R(2,x))]
for a in R(input()):
x=n=0
while n<=a:n+=sum(x%p==0for p in P)==a+1;x+=1
print x-1
It takes about 2 minutes to run to completion for x=8.
Jelly, 9 bytes
Æv=¥ḷ#)Ṫ€
How it works
Æv=¥ḷ#)Ṫ€ - Main link. Takes n on the left
) - For each integer 1 ≤ k ≤ n, so the following:
¥ḷ# - Find the first k integers for which the following is true:
Æv - The number of distinct prime factors
= - equals k
Ṫ€ - Return the last element from each list
J, 32 bytes
({"0 1~i.@#)(]/.~#@~.@q:)
But since I'm answering my own question so late, we'll just leave this answer as a curiosity.
JavaScript, 149 chars
function(n){function f(x){for(r=[],o=x,z=2;z<=o;x%z?++z:(x/=z,r.indexOf(z)+1?0:r.push(z)));return r}for(c=0,i=1;c<n;)f(++i).length==n?c++:0;return i}
Feels unresponsive for n >= 6 so I haven't tested how long it takes (my browser pops up a hung script notification every 10 seconds or so therefore I can't time it accurately and I don't want to completely hang if I check "don't show this again"...)
Edit: To return array is 200 characters (+51):
function(n){function F(){function f(x){for(r=[],o=x,z=2;z<=o;x%z?++z:(x/=z,r.indexOf(z)+1?0:r.push(z)));return r}for(c=0,i=1;c<n;)F(++i).length==n?c++:0;return i}for(a=[];n>0;n--)a.push(f());return a}
Java (Ungolfed)
public class M {
public static void main(String[] a) {
final int N = 100000000;
int[] p = new int[N];
for(int f = 2; f * f < N; f++) {
if(p[f] == 0)
for(int k = f; k < N; k += f)
p[k]++;
}
for(int i = 1; i <= 8; i++) {
int c = 0, j;
for(j = 1; j < N && c < i; j++)
if(p[j] == i)
c++;
if(c == i)
System.out.println(i + " = " + --j);
}
}
}
Uses a sieve algorithm. It's pretty quick. (6 Seconds)
Will work accurately for upto 8, will probably fail for anything higher.
Java, 170 characters in one line
int a(int n) {
int a = 2, t = a, m = 1, i = 1;
Set s = new HashSet();
while (i++ > 0) {
if (t % i == 0) {
s.add(i);
t /= i;
if (t == 1) {
if (s.size() == n) {
if (n == m) {
break;
}
m++;
}
t = ++a;
s.clear();
}
i = 1;
}
}
return a;
}
Update, +77 characters IOL
int[] f(int n) {
int[] f = new int[n];
for (int i = 0; i < n; i++) {
f[i] = a(i+1);
}
return f;
}