Because the 2nd iteration has HUMBLE -: 2 3 5 7 for which the result of
"next" is 2.
   smoutput HUMBLE [ smoutput next '' [ reset ''
1
2 3 5 7
   smoutput HUMBLE [ smoutput next ''
2
3 5 7 4 6 10 14



On Mon, Mar 2, 2020 at 5:07 PM David Lambert <[email protected]> wrote:

> Why is the last number in this post 2 instead of 1 please?
>
> FACTORS=: p: i. 4
> HUMBLE=: 1
> next=: 3 : 0
>  result=. <./ HUMBLE
>  i=. HUMBLE i. result
>  HUMBLE=: ~. (((i&{.) , (>:i)&}.) HUMBLE) , result * FACTORS
>  result
> )
> reset=: 3 :'0 $ HUMBLE=: 1'
>
>
>    next reset''
> 1
>
>    <next^:(<1)reset''
> ++
> ||
> ++
>    next^:(<2)reset''
> 0
> 2
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to