You are asking a good question. I love programming/solving maths problems more than any other work activity but I wonder if I have made a mistake with turning this hobby into my job or if the environment is the problem. I'm going through some big changes in my life now, so time will tell.
Sometimes its environmental. One way to figure this out might be to try changing some parameters and see if you still enjoy things. Its hard for me to say without any context but I hope you find your purpose!
Right, we are getting paid to solve puzzles essentially! Lots of people would love to do that kind of work, and many do it for free solving Sudoku or what not (not that it's mathematically comparable to what OP does, but in a similar vein).