contains(x,y) = { my (m=10^#digits(y)); while (x>=y, if (x%m==y, return (1), x\=10; ); ); return (0); } odd part(n) = n/2^valuation(n,2) slot = [1] \\ next value by odd part unseen = 1 \\ unseen value seen(v) = { my (o=odd part(v)); while (#slot < o, slot = concat(slot, vector(#slot, k, k+#slot)); ); slot[o] > v; } other chain() = { my (c=unseen); for (x=1, oo, if (contains(c*=2, unseen), my (chain = unseen * powers(2, x)); slot[odd part(unseen)] *= 2^(x+1); while (seen(unseen), unseen++; ); return (chain); ); ); } for (c=1, 10 000, print (c " " #other chain())) quit