The largest minimal x has 39 digits.Perlkonig wrote:Can somebody confirm this, please? I was so sure my code was correct, but the max value it's finding is 30 digits long, and the value for D is not being accepted. Thanks!daniel.is.fischer wrote:Yes, the value exceeds 64-bit range, it's a 38-digit number.
Problem 066
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 066

- Francky
- Posts: 90
- Joined: Sat May 07, 2011 3:49 pm
- Location: South of France
Re: Problem 066
I agree with daniel.is.fisher : 38 digits : 16421... <end snipped>thundre wrote:The largest minimal x has 39 digits.Perlkonig wrote:Can somebody confirm this, please? I was so sure my code was correct, but the max value it's finding is 30 digits long, and the value for D is not being accepted. Thanks!daniel.is.fischer wrote:Yes, the value exceeds 64-bit range, it's a 38-digit number.
Edit :
and for other limits:
10³ → 38 digits : 16421... in 7ms
10⁴ → 212 digits : 23551... in 176ms
10⁵ → 724 digits : 91386... in 5s
10⁶ → 2475 digits : 13811... in 163s
(Python3 single thread, on i5-2400)
Last edited by Francky on Mon Sep 17, 2012 10:25 am, edited 1 time in total.
Entia non sunt multiplicanda praeter necessitatem-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 066
That's what I get for y.Francky wrote:I agree with daniel.is.fisher : 38 digits : (snip)thundre wrote:The largest minimal x has 39 digits.
I thought the number of digits in x would be more apropos to the problem, since the answer is supposed to be the D for which minimal x is largest, regardless of y.
BTW I think posting the last 10 digits of either x or y is kind of spoiler-ish.

- Francky
- Posts: 90
- Joined: Sat May 07, 2011 3:49 pm
- Location: South of France
Re: Problem 066
I didn't check x/y, I use P and Q, sorry, but even in this case, I don't get 39 digits.
Here is first ones, and I'll delete them in a few times, not to spoil if it is.
10³ → 36 digits : 63872...
10⁴ → 210 digits : 23611...
10⁵ → 722 digits : 29995...
10⁶ → 2472 digits : 14152...
Edit : last digits snipped.
Here is first ones, and I'll delete them in a few times, not to spoil if it is.
10³ → 36 digits : 63872...
10⁴ → 210 digits : 23611...
10⁵ → 722 digits : 29995...
10⁶ → 2472 digits : 14152...
Edit : last digits snipped.
Entia non sunt multiplicanda praeter necessitatem-
Alanbly
- Posts: 1
- Joined: Mon Feb 11, 2013 9:50 pm
Re: Problem 066
Ok, so I don't want to spoil this problem for anyone, but I also think that the problem is absolutely set up such that you really will have a hard time solving it if you aren't a number theory person and don't research an existing solution. If you research the problem, the solution becomes trivial (well given you've already solved all previous problems). So either bang your head against it for a few hours or read the Wikipedia page on this specific equation and use the methods specified therein and the code you already have and move on.
-
brandish
- Posts: 1
- Joined: Thu Sep 04, 2014 1:18 pm
Re: Problem 066
Don't know where else to write this, but the answer box only accepts 30 digits at the moment. Can this be changed so my hopefully correct answer can get accepted?
- euler
- Administrator
- Posts: 5095
- Joined: Sun Mar 05, 2006 4:49 pm
- Location: Cheshire, England
- Contact:
Re: Problem 066
Quoting from the problem:
You shouldn't need more than four digits.Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.

impudens simia et macrologus profundus fabulae
- mpiotte
- Administrator
- Posts: 1961
- Joined: Tue May 08, 2012 5:40 pm
- Location: Montréal, Canada
Re: Problem 066
brandish wrote:Don't know where else to write this, but the answer box only accepts 30 digits at the moment. Can this be changed so my hopefully correct answer can get accepted?
4 digits should be enough to represent a number not exceeding 1000.... Find the value of D ≤ 1000" ...

-
Montago
- Posts: 3
- Joined: Tue Mar 03, 2015 2:02 pm
- mpiotte
- Administrator
- Posts: 1961
- Joined: Tue May 08, 2012 5:40 pm
- Location: Montréal, Canada
Re: Problem 066
It is implied from the statement about square D and the examples that we are looking for x and y positive integers.Montago wrote:... So ... Why is x=1 and y=0 not a solution for ALL D>0 ??

-
vivekchaudhary
- Posts: 2
- Joined: Sat May 30, 2015 9:12 pm
Problem 66
I'm getting different results using Pell’s Equation and brute force!
Pell's equation results in <snip>, but for <snip>, so <snip> should be the answer.
Can someone please cross-verify my results?
Problem 66 [https://projecteuler.net/problem=66]
EDIT by moderator: merged topic and removed spoilers.
Pell's equation results in <snip>, but for <snip>, so <snip> should be the answer.
Can someone please cross-verify my results?
Problem 66 [https://projecteuler.net/problem=66]
EDIT by moderator: merged topic and removed spoilers.
- mpiotte
- Administrator
- Posts: 1961
- Joined: Tue May 08, 2012 5:40 pm
- Location: Montréal, Canada
Re: Problem 66
Please don't post results in this forum, and use the existing topic if one already exists.vivekchaudhary wrote:I'm getting different results using Pell’s Equation and brute force!
Pell's equation results in <snip>, but for <snip>, so <snip> should be the answer.
Can someone please cross-verify my results?
Problem 66 [https://projecteuler.net/problem=66]
EDIT by moderator: merged topic and removed spoilers.

-
Alex-82w4
- Posts: 20
- Joined: Fri Jan 13, 2017 4:37 pm
Re: Problem 066
hk, I read your post on Diophantine Equations. The problem 66 is a special case, i.e. Pell's equation.hk wrote: Wed Jul 13, 2011 3:25 pm Well, if you look up http://en.wikipedia.org/wiki/Diophantine_equation and look at "Examples of Diophantine Equations" it's there, isn't it? (third example).
What it boils down to is that people are supposed to do this bit of research by themselves and find out what it is about.
The meta goal is to get proficient in this kind of web based self learning, based on the information given to you by the problem statement. That's why I still think that people should abstain from giving such extra information in this forum.
For me you don't need to remove your information as this discussion in itself is very instructive imho, telling people what they are supposed to do.
I can't learn how to find fundamental (first) solution by using
convergents to the regular continued fraction
I created my brute force algorithm in Python. It works for $D\leq7$. When I run it for $D\leq1000$ it calculates only $727$ solutions ($x^2-D*y^2=1$) out of $1000$. What is a good resource to learn about Pell's equations fundamental solutions?
Thanks.

The friend key is 1004797_CkgowZqfFi0qQMGOqVjB0RP8htEhkWW2
- sjhillier
- Administrator
- Posts: 561
- Joined: Sun Aug 17, 2014 4:59 pm
- Location: Birmingham, UK
- Contact:
Re: Problem 066
Well that link is already a good start. Some of the links onwards from that page should also help. As a general point, I always find the Wolfram MathWorld pages very useful too. For the Pell Equation in particular, there are plenty of resources around the web, at various levels. It's worth spending a bit of time getting to grips with the Pell Equation and Continued Fractions, as they are often very useful in these types of problems.Alex-82w4 wrote: Mon Feb 06, 2017 2:26 pm
hk, I read your post on Diophantine Equations. The problem 66 is a special case, i.e. Pell's equation.
-
Alex-82w4
- Posts: 20
- Joined: Fri Jan 13, 2017 4:37 pm
Re: Problem 066
Thank you, sjhillier, for encouraging me to learn. 
The problem solved !!
The problem solved !!

The friend key is 1004797_CkgowZqfFi0qQMGOqVjB0RP8htEhkWW2