Euler's totient strikes again.

Had to limit the search range pretty severly to get this under a minute
Improve totient function
Simplified solution