Here's a corrected version of allbut2

allbut2f=:3 :0
 n=.1+i.y
 q=._ q: n
 s=.(*."1 1:=+/)(="1 >./)q
 (*./x:n)%>./(_ q:inv s)*adja n*(1=+/|:q)*.adja+./"1 s
)

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

Some notes on results used in this verb:
  n is the relevant counting numbers
  q lists the prime powers corresponding to n
  s locates the unique prime powers (from q)

The result is the least common multiple of those counting
integers divided by the largest product of any of the
prime factors corresponding to one of those
unique prime powers with its largest adjacent prime.

This verb runs significantly faster if I replace
(*./x:n) with the equivalent (_ q:inv x:>./q)

FYI,

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

Reply via email to