Problem 43179. Red and green towers
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).
![](/matlabcentral/answers/uploaded_files/60747/color_towers.png)
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 Solvers23
Suggested Problems
-
Remove all the words that end with "ain"
2223 Solvers
-
Project Euler: Problem 5, Smallest multiple
1318 Solvers
-
Generate N equally spaced intervals between -L and L
854 Solvers
-
Sum of odd numbers in a matrix
560 Solvers
-
146 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!