[Jprogramming] Project Euler
'Jon Hough' via Programming
programming at jsoftware.com
Wed Mar 15 03:28:45 UTC 2017
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. 1000000
The actual numbers are the index + 1.
If you want to look at my answer, it is here: https://github.com/jonghough/projecteulersolutions/blob/master/answers/projecteuler70.ijs
--------------------------------------------
On Wed, 3/15/17, 'Jon Hough' via Programming <programming at jsoftware.com> wrote:
Subject: Re: [Jprogramming] Project Euler
To: programming at jsoftware.com
Date: Wednesday, March 15, 2017, 12:24 PM
> " 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 totients, you need to divide them by the totient
and find which number is the minimum.
Also, I stole totient from J phrases too.
--------------------------------------------
On Wed, 3/15/17, Don Guinn <donguinn at gmail.com>
wrote:
Subject: Re: [Jprogramming] Project Euler
To: "Programming forum" <programming at jsoftware.com>
Date: Wednesday, March 15, 2017, 12:09 PM
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 had
as a permutation of the digits given sorted by
(%totient)n . I cheated.
Stole totient from
J phrases.
The only thing I
can think of is that they wanted something other than the
n that I found.
On Tue, Mar 14, 2017 at 8:12 PM, 'Jon
Hough' via Programming <
programming at jsoftware.com>
wrote:
> 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
>
--------------------------------------------
> On Wed, 3/15/17, Don Guinn <donguinn at gmail.com>
wrote:
>
> Subject:
[Jprogramming] Project Euler
> To:
"Programming forum" <programming at jsoftware.com>
> Date: Wednesday, March 15, 2017, 9:37
AM
>
> 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
> answer is wrong?
>
> Glad to discuss it
in the forum, but if anyone wants to
>
contact me
> privately so we don't
break Project Euler rules, contact me
>
at
> donguinn at gmail.com
>
> Thanks.
>
----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list