Raul Miller schreef:
> 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=:</\&.|.
>
Raul I'm in doubt if your verb always produces a correct answer.
So please follow me on this:

Your verb gives

   allbut2f 61
9534410355667921512188400

   allbut2f 62
9534410355667921512188400

Testing for all divisor pairs consisting of successive
values <= 61

   (,>:)2+I. 0<*/"1(]|[:*./(1x+i.61)-."1])"1(,>:)"0[2x+i.59
31 32
-> for 31 & 32 there exists a X for n=61

But for n=62 there are no k,k+1 <= 62 for which
 'k and k+1 are not divisors of X' is true.

   2+I. 0<*/"1(]|[:*./(1x+i.62)-."1])"1(,<:)"0[2x+i.61
empty

where do I go wrong???


FWIW here's my allbut2 verb with your 'enhanced' lcm
and based on my conjecture.

ab217=: 3 : 0
 j=: x:<.&.(2&^.)y
 r=. 1x+i.y
 s=. 0$0
 p=: j-1x
 q=: j+1x
 v1=: _ q:inv x:>./ _ q: r-.j,p
 v2=: _ q:inv x:>./ _ q: r-.j,q
 if. (0<j|v1)*.0<p|v1 do. s =. s, v1 end.
 if. (0<j|v2)*.0<q|v2 do. s =. s, v2 end.
 <./s
)


   ab217 61
9534410355667921512188400

   ab217 62
_

   _10{.":ab217 12197
1212800000

Conjecture:
For a certain n it is possible that there exists at least one
X = lcm {2,3..n} - {p,q}    <--- set difference
not divisible by
  or 2^m and 2^m + 1 \
                     > = {p,q}
  or 2^m - 1 and 2^m /
 
in which:
m is <.&.(2&^.)n
and 2^m +/- 1  is a prime or a prime^2 (case: 8,9)

So enough guess work I think and:
assumption is the mother of all disasters, so ...shoot




=@@i



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

Reply via email to