How to implement the recursion with 2 variables included?

Hi,Masters:<o:p></o:p>

  I have a task to calculate a value, which includes 2variables and should be implemented with recursion restate.<o:p></o:p>

  The formula is simple: Fn = Fn-1 * 2+ An (Given conditions:F0 = 10, A = 1 + til 5)<o:p></o:p>

<o:p> </o:p>

  I implemented the part of “_Fn =Fn-1 * 2_“ in Q with “5 {x * 2}\ 10”, but I was blocked with the secondvariable. Do you have any comment? Appreciate for you advice.

Thanks

hzadonis

given function ‘f’ defined as:

f:{[F;A]A+F*2}

does this meet your requirement?

q)f[10;til 5]
20 41 84 171 346

Hi, Nick:

  Thank you. Let me try your method.

  I wrote a function and create a temp table to store array, then use a while loop to calculate values, not smart.

?2020?7?31??? UTC+8 ??11:58:11<Nick> ???

given function ‘f’ defined as:

f:{[F;A]A+F*2}

does this meet your requirement?

q)f[10;til 5]
20 41 84 171 346