Actually, come to think of it, the fastest program would simply enumerate the valid answers and then spit them out on demand.
That's not very interesting, but the rules do not seem to exclude this approach, nor minor variations on this theme (such as translating the enumeration to code instead of representing it as literal data). That said, the few solutions I have inspected do not seem to have used this approach. If they had, I imagine they would be faster. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
