s = 0 seen(v) = bit test(s, v) see(v) = s = bit or(s, 2^v) unseen = 1 other(p,n) = { see(p); while (seen(unseen), unseen += 2; ); for step (k=unseen, oo, 2, if (!seen(k) && (p+k)%n==0, return (k); ); ); } { for (n=1, 10 000, v = if (n==1, 1, other(v,n)); print (n " " v) ) } quit