login
A333907
For n >= 1, a(n) = Sum_{k=1..n} prevfib(k) + nextfib(k) - 2*k, where prevfib(k) is the largest Fibonacci number < k, nextfib(k) is the smallest Fibonacci number > k.
0
0, 0, 1, 1, 2, 3, 2, 4, 7, 8, 7, 4, 7, 13, 17, 19, 19, 17, 13, 7, 12, 23, 32, 39, 44, 47, 48, 47, 44, 39, 32, 23, 12, 20, 39, 56, 71, 84, 95, 104, 111, 116, 119, 120, 119, 116, 111, 104, 95, 84, 71, 56, 39, 20, 33, 65, 95, 123, 149, 173, 195, 215, 233, 249, 263, 275
OFFSET
1,5
EXAMPLE
a(1) = (0 + 2 - 2*1) = 0;
a(2) = (0 + 2 - 2*1) + (1 + 3 - 2*2) = 0;
a(3) = (0 + 2 - 2*1) + (1 + 3 - 2*2) + (2 + 5 - 2*3) = 1;
a(4) = (0 + 2 - 2*1) + (1 + 3 - 2*2) + (2 + 5 - 2*3) + (3 + 5 - 2*4) = 1.
PROG
(PARI) isfib(k) = my(m=5*k^2); issquare(m-4) || issquare(m+4);
nextfib(n) = my(k=n+1); while (!isfib(k), k++); k;
prevfib(n) = my(k=n-1); while (!isfib(k), k--); k;
a(n) = sum(k=1, n, prevfib(k) + nextfib(k) - 2*k); \\ Michel Marcus, Apr 10 2020
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Apr 09 2020
STATUS
approved