I looked up the Euler totient function on Wikipedia. Seemed simple enough. Tried to solve by finding prime factors through trial division but (obviously) that took too long. Then I modified my prime sieve to generate the prime factors at the same time as the composites. This improved things a great deal but my method uses a lot of memory. I had to run the code on my own machine to get it to work.
For the example below, I've reduced the upper limit of the numbers that are checked so that the script runs on Trinket. It seems obvious that there is a more memory efficient way of doing this, but it's 1 AM and I want to go to sleep. As ever, it turns out you can solve this in seconds with a pen and paper if you have the brains.