Raul Miller schreef: > gcd=: *./@x: > gcd=: ([:x:>./)&.(_&q:) NB. fast version > > F=:gcd@:>:@i.%((]+:@x:@[EMAIL PROTECTED]>:*.-:@[<])(-.]-.]&.(p:inv))@(1 > _1+2^2<[EMAIL PROTECTED])) > > Impressive speed improvement!
Sorry to bother you again, but this still keeps me busy about the overall correctness (not mentioning this all is based on a conjecture). Showing the results of the development of the verb in the lower range of n: allbut2f"0 [4+i.15 2 10 12 84 60 180 180 1980 1980 25740 25740 25740 _ 360360 360360 allbut2f"0 [4+i.14 2 10 12 84 60 180 180 1980 1980 25740 25740 25740 _ 360360 allbut2g"0 [4+i.14 2 10 6 42 60 180 180 1980 1980 25740 _ _ _ 360360 F"0 [4+i.14 2 6 6 42 60 180 180 1980 1980 25740 _ _ _ 360360 - The following verb covers (tries to) all special cases - Improved performance by stripping ext. precision where possible. - Verbose output: n,d,d+1,min(X) ab217i=: 3 : 0 j=: x:<.&.(2&^.)y r=. 1+i.y s=. 0$0 p=: j-1 v1=: lcm r-.j,p if. (0<j|v1)*.0<p|v1 do. s =. v1 end. if. j<y do. q=: j+1 v2=: lcm r-.j,q if. (0<j|v2)*.0<q|v2 do. s =. v1<.v2 end. if. v1<:v2 do. s=. p,j,s else. s=.j,q,s end. else. s=. p,j,s end. y,s ) ,.ab217i"0 [4+i.14 4 3 4 2 5 4 5 6 6 4 5 6 7 4 5 42 8 7 8 60 9 7 8 180 10 7 8 180 11 7 8 1980 12 7 8 1980 13 7 8 25740 14 8 9 60060 15 8 9 60060 16 15 16 0 17 16 17 360360 checking all divisor pairs for n=14 (,>:)2+I. 0<*/"1(]|[:*./(1x+i.14)-."1])"1(,>:)"0[2x+i.12 8 9 And this is the special case of divisors I mentioned before: 2^m+1 = prime^2 (2^3+1 = 3^2) A conclusion could be: in case of divisors 3,4 ; 4,5 (n=5,6) and 7,8 ; 8,9 (n=9..13) you have two X's, in all other cases, if there's a X for a certain n, you have just one X. ??? **Things to investigate: Are there solutions that give an X for divisors other than 2^m and 2^m+/-1, with 2^m+/-1 is prime and n>14? IOW are there more possibilities like 2^m+/-1 = prime^p and do they give a solution for X. =@@i ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
