nb = [0]
wanted = vector(10 000+1)
u = 0

{
	f = 0;
	for (n=1, 10 000 000,
		v=if (1+f<=#nb, nb[1+f], 0);
		if (v<#wanted && !wanted[1+v],
			wanted[1+v] = n;
			while (wanted[1+u],
				print (u " " wanted[1+u]);
				if (1+u++>#wanted,
					break (2);
				);
			);
		);
		while (1+v>#nb,
			nb = concat(nb, vector(#nb));
		);
		nb[1+v]++;
		if (v==0,
			f=0,
			f++
		);
	);
}

quit