I've been doing project Euler problems and I realise it really really helps to know Number Theory to get to an optimal solution for problems. Can anyone recommend good books on the subject? While learning via problem-solving is fun, most of the time it boils down to me sitting with a naive, brute-force solution that's too slow and then google how to make it fast, discover a new number theory axiom/tool and then changing the algorithm. There's gotta be a better way to learn...