How could i make a Hexnacchi sequence in matlab?

I have a big problem, i need to make a program for Hexnacchi sequence ( 1, 1, 2, 4, 8, 16, 32, 63, 125 is a case of the sequence)does anybody know how?

Answers (1)

Is this a homework exercise? I don't mean to ask the obvious, but since you didn't mention it, did you try a for loop? Or try the sum() function?

2 Comments

yes it is and i'm having real problems with it i should do it with a loop but i cant figure out how
Then you should have marked it as homework. I'll do it for you.
See what you can do with this massive hint:
Hexnacchi(1) = 1;
for k = 2 : 10
index2 = k-1
index1 = max(k-6, 1)
Hexnacchi(k) = .....
end
Another hint: it involves the sum() function.

This question is closed.

Asked:

on 11 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!