Linda, The choice to start the Fibonacci sequence at 0 is to conform with some of the other answers at the Rosetta Code page,
Y combinator https://rosettacode.org/wiki/Y_combinator Most people start numbering items at 1 and when producing a function (Fib) for the Fibonacci sequence the correspondence is, 1 2 3 4 5 6 7 8 9 10 ... 1 1 2 3 5 8 13 21 34 55 ... Some of us, and J, start numbering items at 0. So we can use the correspondence, 0 1 2 3 4 5 6 7 8 9 10 ... 0 1 1 2 3 5 8 13 21 34 55 ... So, either way, Fib(10) is 55 and we all agree even if we disagree. (Apparently, the Fibonacci function can be extended to the complex plane and beyond using, the so-called, Binet's formula.) I hope it helps On Thu, Nov 29, 2018 at 10:40 PM Linda Alvord <[email protected]> wrote: > Jose, Somehow this surprised me. > > Y=: ($:`)(`:6) > N=: 1 :'(u@:<:@:<: + u@:<:)^:(1 < ])' > P=: (5!:1)<'N' > P Y("0) i.11 > 0 1 1 2 3 5 8 13 21 34 55 > > Y > ($:`)(`:6) > N > 1 : '(u@:<:@:<: + u@:<:)^:(1 < ])' > P > ┌────────────────────────────────────────────┐ > │┌─┬────────────────────────────────────────┐│ > ││:│┌─────┬────────────────────────────────┐││ > ││ ││┌─┬─┐│┌─┬────────────────────────────┐│││ > ││ │││0│1│││0│(u@:<:@:<: + u@:<:)^:(1 < ])││││ > ││ ││└─┴─┘│└─┴────────────────────────────┘│││ > ││ │└─────┴────────────────────────────────┘││ > │└─┴────────────────────────────────────────┘│ > └────────────────────────────────────────────┘ > > > Linda > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
