A more interesting variation on fibonacci might be illustrated by this version
fibphi=: 3 : '(%:5)%~(p^y)-(-.p)^y [ p=.-:>:%:5' which uses the golden ratio in a slightly different fashion than "f3" on the J wiki fibonacci sequences page. This version is interesting in spite of the fact that it quickly gives the same answers as the others in this thread because it is not restricted to a domain or range of positive real integers. Try load 'plot' plot fibphi i:5j99 and 'surface' plot fibphi j./~i:3j99 to see why this might be a tad more interesting than the others. BTW, I noticed that, contrary to what it says on the fibonacci sequences page, "f3" is only good up to about n=70 (as is fibphi). One interesting feature of the recursive memoized version (mentioned earlier in this thread) fibM0=: 3 : ' if. 1>:y do. y else. (fib y-1)+fib y-2 end.'M. is that it takes extended arguments we can use to check the other versions' accuracy, e.g. (0j0&":)|:(f3,fibphi,fibM0)&>70x 71x 190392490709135 308061521170131 190392490709135 308061521170131 190392490709135 308061521170129 I'm assuming the last one is correct. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
