I don't see that error anywhere in your worksheet.
However, regarding your definition of i(n), v.k is a range variable, and you can't use a range variable like that. It's not clear to me exactly what you want to do though. If v.k were a vector then i(n) would return multiple values for any given value of n (the number of values being equal to the number of elements in the vector). Is that what you want, or something different?