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, if (d*reverse(d)==w[n], print (n " " d); break; ); ); ); } quit