> Or, generalizing the question, given a list N how can i know the index of the highest element?
N i. >./ N , equivalent to (i.>./) N . The latter is special-coded. http://www.jsoftware.com/help/dictionary/special.htm On Fri, Nov 30, 2012 at 4:00 AM, alessandro codenotti <[email protected]>wrote: > > Solving Project Euler 69 i encountered a problem, with the following J > code: > > >./(>:i.10e6)%5 p: >:i.10e6 > > i can easily find out which is the maximum value of n/phi(n) for n<10e6, > but how can i know what is the value of n? > > Or, generalizing the question, given a list N how can i know the index of > the highest element? > I'm really a beginner in J so i guess the solution to my problem is very > very easy but i cannot find it... > Thank in advice to everyone that will help me! > > p.s. > here is the PE 69 i referred to: > > Euler's Totient function, φ(n) [sometimes called the phi function], is > used to determine the number of numbers less than n which are relatively > prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine > and relatively prime to nine, φ(9)=6. > > It can be seen that n=6 produces a maximum n/φ(n) for n 10. > Find the value of n 1,000,000 for which n/φ(n) is a maximum. > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
