Here's how to do it for k=2. Define f(x) in any way you like, for x in the interval 1≤x<2. Then for every (positive or negative) integer n, define (for 1≤x<2). This function will even be continuous (except at 0), provided that f(x) is continuous in the interval [1,2) and . But it will not be continuous at 0 unless f is constant.

The same construction will work for any k>1, if you define f arbitrarily in the interval [1,k) and then define .