Re: [Jprogramming] Project Euler

2017-03-14 Thread chris burke
> Also, I stole totient from J phrases too. You can also steal it from the vocabulary, e.g. 5 p: 12 4 On Tue, Mar 14, 2017 at 8:24 PM, 'Jon Hough' via Programming < [email protected]> wrote: > > " I supplied the first number that had > as a permutation of the digits given sorted by

Re: [Jprogramming] Project Euler

2017-03-14 Thread 'Jon Hough' via Programming
Sorry, I just reread what you wrote. It seems what you did is correct. I can only guess its some indexing error, because you have to remove 1. i.e. Only values between 2 and 10^7 are included, so perhaps you indexed wrong. So if you do myVerb >: i. 100 The actual numbers are the index + 1.

Re: [Jprogramming] Project Euler

2017-03-14 Thread 'Jon Hough' via Programming
> " I supplied the first number that had as a permutation of the digits given sorted by (%totient)n" No, from the values that is that are permutations of their totients, the question wants the minimum value of N % totient N. So after finding all the values that are permutations of their totient

Re: [Jprogramming] Project Euler

2017-03-14 Thread Don Guinn
My second approach was brute force like you did. It gave the same number as my first approach. And interestingly it was faster than my first approach. Happens sometimes. The only thing I can think of is that I found the answer but I didn't supply what they wanted. I supplied the first number that h

Re: [Jprogramming] Project Euler

2017-03-14 Thread 'Jon Hough' via Programming
I just tried it and got the right answer. But my approach is essentially brute force: I basically stringified (":) the totient result, sorted it, and compared to the sorted stringified original number. I can be more specific if you like. Regards, Jon ---

[Jprogramming] Project Euler

2017-03-14 Thread Don Guinn
Has anyone out there solved problem 70? I have worked it two ways which give the same answer but it is given as incorrect. I don't want to divulge what I did as that is against their rules. I must be missing something and presenting the wrong number for the result. Or is it possible that their answ

Re: [Jprogramming] Moving median - any good methods?

2017-03-14 Thread 'Mike Day' via Programming
Thanks, I'll have a look. M Please reply to [email protected]. Sent from my iPad > On 14 Mar 2017, at 23:52, 'Jon Hough' via Programming > wrote: > > I haven't attempted that Project Euler Question. But I did implement a > priority queue a while back. > I just put it here: >

Re: [Jprogramming] Moving median - any good methods?

2017-03-14 Thread 'Jon Hough' via Programming
I haven't attempted that Project Euler Question. But I did implement a priority queue a while back. I just put it here: https://gist.github.com/jonghough/e3566dcfea95e4dbc5b23f9295388df6 It can handle arbitrary comparators, i.e. any verb returning 0 or 1. However, I doubt it is of much use, bec

[Jprogramming] Moving median - any good methods?

2017-03-14 Thread 'Mike Day' via Programming
This has arisen in solving Euler Project problem 593. https://projecteuler.net/problem=593 It is basically quite easy, especially for the examples with given answers, ie for F(100,10) and even for F(10, 1) but as usual with these problems, there's a sting in the tail, in the computing