u0 = 1, u1 = 2 and the relation
6unun+1-5unun+2+un+1un+2 = 0 calculate un for any integer
n >= 0.
fcn(n) returns un: fcn(17) -> 131072, fcn(21) -> 2097152
You can look at this as
-Purely algorithmic from the definition of u^n
-the second one - not at all mandatory, but as a compliment - is to get a bit your head around and find which sequence is hidden behind u^n
Want to propose a challenge idea for a future post? Email email@example.com with your suggestions!