reverse(n) = fromdigits(Vecrev(binary(n)), 2) w = [0] nb = 0 { forstep (k=1, 2^15, 2, if (nb++>#w, w = concat(w, vector(#w)); ); w[nb] = k*reverse(k); ); w = Set(w[1..nb]); for (n=1, #w, fordiv (w[n], d, r = reverse(d); if (d*r==w[n], print (n " " r); break; ); ); ); } quit