OFFSET
0,3
COMMENTS
LINKS
EXAMPLE
For n = 1:
- 1 <= 1 < 2,
- so a(1) = 1 + a(2-1-1) = 1 + 0 = 1.
For n = 6:
- 5 <= 6 < 8,
- so a(6) = 5 + a(8-6-1) = 5 + a(1) = 5 + 1 = 6.
For n = 14:
- 13 <= 14 < 21,
- so a(14) = 13 + a(21-14-1) = 13 + a(6) = 13 + 6 = 19.
For n = 40:
- 34 <= 40 < 55,
- so a(40) = 34 + a(55-40-1) = 34 + a(14) = 34 + 19 = 53.
PROG
(PARI) a(n) = { if (n==0, return (0), for (k=2, oo, if (fibonacci(k)<=n && n<fibonacci(k+1), return (fibonacci(k) + a(fibonacci(k+1)-n-1))))) }
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Apr 24 2021
STATUS
approved