Frankie has a large number of wooden cubes, painted in red and green. He is building little towers with his cubes, by stacking them on top of each other.
He got bored after a while, so he introduced a rule: two red cubes may not be touching (see image).

Given n (the maximum number of cubes in a tower), determine the number m of different towers that Frankie can build.
Example: for n = 2, he can make 5 towers, so m=5:
- [Red];
- [Green];
- [Red, Green];
- [Green, Red];
- [Green, Green].
You may assume that the input is an integer greater than zero.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers29
Suggested Problems
-
Check to see if a Sudoku Puzzle is Solved
341 Solvers
-
1747 Solvers
-
Find the maximum number of decimal places in a set of numbers
3547 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
265 Solvers
-
Factorions: Numbers that equal the sum of the factorials of their digits
83 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!