big = 1 000 000 s = 0 S = Set([]) unseen = 0 seen(v) = if (v < big, bit test(s, v), set search(S, v)) see(v) = if (v < big, s = bit or(s, 2^v), S = set union(S, Set([v]))); while (seen(unseen), unseen++) cc = [0] avoid(x) = { if (x==0, return (unseen); ); my (w=1, b, c); for (e=0, oo, if (!bittest(x, e), b=2^e; if (#cc==w, cc=concat(cc, vector(#cc)); ); for (k=1, w, c=cc[w+k]=b+cc[k]; if (!seen(c), return (c); ); ); w*=2; ); ); } { a = vector(100 000); \\ A352809 b = vector(10 001, n, -1); \\ A353266 = A352809^-1 u = 0; for (n=1, #a, my (x=0); fordiv (n, d, x=bitor(x, a[d]); ); see(a[n]=avoid(x)); if (a[n]+1<=#b, b[a[n]+1] = n; while (b[u+1]>=0, print (u " " b[u+1]); if (u++==#b, break (2); ); ); ); ); } quit