I wrote:
>   allbut2 5 7 11 13
> 10 252 712800 111196800

Oops!  (Brian Schott pointed out that this was wrong.)

Corrected version:

allbut2=:3 :0"0
  n=.1+i.y
  p=.n e. i.&.(p:inv) y
  s=.last (adj p)*.+./"1(> 1 >./\. ])_ q:n
  >./&.(_&q:)x:n^-.s +. last p *.adj s
)

adj=:[: +./ 1 _1 |.!.0"0 1 ]
last=:</\&.|.

   allbut2 5 7 11 13
10 42 1980 25740

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to