Not quite as short as Brian Schott's approach:
F=: (+/&i./ ,&.> <./&i./@(1 _1*]))@$ { +/\./.
or, if you prefer,
G=: (+/&i./ ,&.> [: |."1 <./&i./)@$ { +/\./.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
