It's a pretty good improvement already.

   hc10k =:  , ] +/@:{~ (,&<: -.)@{:
   AnN   =:  % 1+i.@:#                  NB.  a(n)/n
   MxAnN =:  >./;.1~ 2 (=<.)@:^. 1...@# NB.  Max a(n)/n btw successive 2^

   HCF=. 3 : '1 1,(#2...@#);(,<@;@(|.@(#;. 1) (],~1$~[)&.>
<@:>:;.1)@>@{:)^:(y-2) <2'

   6!:2 'xx=. mx...@ann 1 1 hc10k @]^:[~ 2^20'
2485.4382
   6!:2 'xx2=. mx...@ann HCF 20'
0.38284575
   xx-:xx2
0

   >./|xx-xx2
9.536725e_7
  (] i. >./) |xx-xx2
20
   20{&>xx;xx2
0.50000095 0.5

I notice the non-J examples on Rosetta Code have full-blown examples of
output; perhaps the J example could end with a line like:

   >(<'Maximum of "a(n)/n" >=2^'),&.>(":&.>i.#xx2),&.>(<' and
<2^'),&.>(":&.>>:i.#xx2),&.>(<' is '),&.>":&.>xx2
Maximum of "a(n)/n" >:2^0 and <2^1 is 1
Maximum of "a(n)/n" >:2^1 and <2^2 is 0.66666667
Maximum of "a(n)/n" >:2^2 and <2^3 is 0.66666667
Maximum of "a(n)/n" >:2^3 and <2^4 is 0.63636364
...

On Thu, Mar 11, 2010 at 12:37 PM, Aai <[email protected]> wrote:

> Still working on it. Perhaps it's possible to improve this approach  :-)
>
> ...
-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to