tr(v)=if (v>=0, 1+2*v, -2*v)
s = 0
seen(v) = my (w=tr(v)); bittest(s,w)
see(v) = my (w=tr(v)); s=bitor(s,2^w)

{
	v=1;
	for (n=1, 10 000,
		for (w=1, oo,
			g=gcdext(v,w)[1];	\\ A345415(v,w)
			if (!seen(g),
				print (n " " v);
				see(g);
				v=w;
				break;
			);
		);
	);
}

quit