func = [ n -> n, prime ]
rem = vector(#func);
idx = vector(#func);

{
	for (n=1, 10 000,
		for (i=1, #rem,
			while (rem[i]==0,
				rem[i] = func[i](idx[i]++);
			);
		);
		v = vecmin(rem);
		print (n " " v);
		for (i=1, #rem,
			rem[i] -= v;
		);
	);
}

quit