I'm wondering how Roger's   % 1 +. (+%)/\ 100 $ 1x
might accept input seeds -- as many as user enters.

Since my stumble over from APL decades ago, I've
used the following to do this (& output mod cycles).

FibLuc =: 4 : 0
  NB. Cyc =. Mod FibLuc Seeds;Tail;Ord
  Ord=. -$Cyc=. Tail=. Seeds=. x|y
  whilst. -. Seeds-: Tail=. Ord {. Cyc
  do.
    Cyc =. Cyc, x|+/Tail
  end.
  Cyc =. Ord }. Cyc
  ]Cyc
)

It works, ...
   12 FibLuc 1 1
1 1 2 3 5 8 1 9 10 7 5 0 5 5 10 3 1 4 5 9 2 11 1 0
   21 FibLuc _4 3
17 3 20 2 1 3 4 7 11 18 8 5 13 18 10 7

but could maybe stand elegantifying.  Any ideas?
(For fun, that is.  This isn't a call for help.)

Pete


Roger Hui wrote:
 % 1 +. (+%)/\ 10 $ 1x
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to