s = 0
unseen = 1
seen(v) = bit test(s, v)
see(v) = s = bit or(s, 2^v); while (seen(unseen), unseen++)

other(pp) = {
	for (v=unseen, oo,
		if (!seen(v) && gcd(pp, v)==1,
			return (v);
		);
	);
}

{
	m=0;
	for (n=1, oo,
		see(v=if (n<=2, unseen, other(pp)));
		if (isprime(v),
			print (m++ " " n);
			if (m==10 000,
				break;
			);
		);
		[pp,p] = [p,v];
	);
}

quit