Originally Posted by

**baseballr6** Hey, I am struggling with coming up with an example of a function that is differentiable on the integers but non-differentiable everywhere else. I have tried looking at various piecewise functions, but none seem to work. I was thinking

f(x)= 0 if x is an integer

f(x)= 1/q if x is rational

and then i don't know what to do if f(x) is irrational.

I know that I am looking for a function that will be discontinuous and therefore nondifferentiable on at non-integer values.

Since I want it to be differentiable on the integers, I want my function to be continuous at the integers.

I know these things, but I cannot seem to connect the dots and it's driving me insane. Please help!