allocate mem(2^30)

s = 0
unseen = 1
seen(v) = bittest(s, v)
see(v) = s = bitor(s, 2^v); while (seen(unseen), unseen++)

rad(n) = vecprod(factor(n)[,1]~)

{
	q = 2;	\\ next prime to look for
	m = 1;	\\ m = primepi(q)

	for (n = 1, oo,
		if (n==1,
				v = 1,
			n==2,
				v = 6,
				for (w=unseen, oo,
					if (!seen(w),
						if (omega(w)==1,
								see(w),
							gcd(pp, w)==1 && gcd(p, w)>1 && rad(p) % rad(w),
								v = w;
								break;
						);
					);
				);
		);

		while (v % q==0,
			print (m " " n);
			if (m++ > 10 000,
				break (2);
			);
			q = nextprime(q+1);
		);

		see(v);

		[pp, p] = [p, v];
	);
}

quit