How would you write an implicit or explicit recursive verb for this
sequence formula?

a1=.4

a1 , (a2=.1-~2*a1) , (a3=.1+~2*a2) , (a4=.1-~2*a3) , (a5=.1+~2*a4) ...
(an=.1(+-)~2*an-1


The verb would be specified as x f y, where x is the starting integer a1,
and y is the number of terms (n) - or vice versa.

The result will be a vector n items long. Note the alternating sign in each
term


Example:

4 f 5

4 7 15 29 59


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

Reply via email to