Comments

ok,Thank you got it

yes, i know it but can we do it in O(logk) or O(logn) [base 2]?

can we do problem D using binary search?

Yes got it.it is just simple pattern for s(n). Thank you very much

correct me if i am wrong if we want to find s(n) = f(0)+f(1)+f(2)+f(3)+...+f(n): where f(0)=f(1)=1; then T = [0 1 0 0 0] [-1 1 0 1 0] [0 0 1 0 0] [0 0 1 1 0] [-1 1 1 1 1]

so [f(n-2)] [f(n-1)] [1] [n] [s(n)]

to [f(n-1)] [f(n)] [1] [n+1] [s(n+1)]

and power of T is n-1

what will be the matrix T for this relation f(n) = f(n-1) — f(n-2) + n ?