f =: 3 : 'y % (5 p: y)' lst =: f i.1000000 lst i.{.\:~lst
Sunday, November 24, 2013
Problem 69 - J
I decided to skip problem 68, at least for a little bit - it involves magic and polygons and all sorts of weird stuff. So, instead I decided to solve problem 69. This problem is rather simple in J, where a reasonably efficient implementation of Euler's totient function is part of the language: (5 p: y) is the totient of y. So, with that, writing a solution was not hard at all. Now, I am sure there are better solutions, as mine runs in about 20 seconds, but what works works.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment