P(0) = P(1) = P(2) = 1
The 0th, 1st, and 2nd terms are all 1. The recurrence relation is stated below:
P(n) = P(n - 2) + P(n - 3)
Thus, it yields the following sequence:
1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, 265, 351, ...
Using these numbers as side lengths of equilateral triangles yields a nice spiral when you place them all together, much like the Fibonacci Spiral:
Image courtesy of Wikipedia
Your task is to write a program that recreates this spiral by graphical output, with input corresponding to which term.
- Your submission must be able to handle at least up to the 10th term (9)
- Your submission must be a full program or function that takes input and displays a graphical result (either outputs an image or graphs, etc)
- You must show proof of your graphical output in your submission
- Rotations of the output are allowed, in 60 degree multiples, with the same representation
- Going counter-clockwise is also allowed
- Standard loopholes are forbidden
You may assume that input will be >0 and that correct format of input will be given.
This is code-golf, so the shortest code in bytes wins. Happy New Years everyone!