It's fine to work on any problem, so long as it generates interesting mathematics along the way - even if you don't solve it at the end of the day.
Andrew WilesMathematics... is a bit like discovering oil. ... But mathematics has one great advantage over oil, in that no one has yet ... found a way that you can keep using the same oil forever.
Andrew WilesI carried this problem around in my head basically the whole time. I would wake up with it first thing in the morning, I would be thinking about it all day, and I would be thinking about it when I went to sleep. Without distraction I would have the same thing going round and round in my mind.
Andrew Wiles