Project Euler 69 - Totient Maximum
Project Euler 69 - Totient Maximum
Official link: https://projecteuler.net/problem=69
Thought Process
Thought Process
First some research on Euler's Totient Function, helps us find a way to easily calculate φ(n)
If you're confused why we need to look for the number with the most distinct factors, it is because p(i)/(p(i) - 1) is slightly greater than 1, so the more multiplications we get the bigger the number will get.
Used my prime generator function to find all primes less than sqrt(1000000)
Interactive Code
Interactive Code
Enter an integer (yourinput)
Code will output the the n < yourinput for which n/φ(n) is a maximum