Question: How does one code a recursive sequence that depends on two previous values?

Hi Mapleprimes people and robots,


My question is regarding a recursive sequence.  It can be defined non-recursively as - 


a(r) :=  0.8*3^r + 0.2*(-2)^r.

The first few terms are - 

1,2,8,20,68,188, and so on.

Here is my Maple Worksheet.
recursive_sequence_A133467.mw      recursive_sequence_A133467.pdf

I want some Maple code that will produce 30 terms of this sequence.  It is defined as

s[1]:=1:
s[2]:=2:

for n>2 we let s[n] = s[n-1] + 6*s[n-2].

Let me know if my question does not make sense.

Regards,
Matt

 

Please Wait...