Jump to navigation Jump to search
Again, J's primes primitive trivializes the problem. can be computed quickly using 5 p: y, so it is sufficient to brute-force.
(% 5&p:) i.9 NB. hook to compute n/φ(n) 0 1 2 1.5 2 1.25 3 1.16667 2 (i. >./) (% 5&p:) i.9 NB. add second hook to find index of the max value 6 NB. since the input is a list of indices, no other work is needed (i. >./) (% 5&p:) i. 1e6 NB. the answer, this takes roughly half a second on my Dell Precision 5530 510510