I think I understand the question (even if I can't solve it yet), but it appears that "denominator" is being used twice in the same sentence to mean two different things, which confused me initially. Should it be disambiguated?Find the sum of all denominators of the best approximations to √n for the denominator 1012, where n is not a perfect square and 1 < n [le] 100000.
Problem 192
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.
-
JohnMorris
- Posts: 64
- Joined: Sun Dec 23, 2007 6:38 am
P192 clarification
Problem 192 says:

- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: P192 clarification
Have you a suggestion?
Edit: I introduced the term "denominator bound", is that better?
Edit: I introduced the term "denominator bound", is that better?
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
- Georg
- Posts: 157
- Joined: Mon Jan 21, 2008 7:00 am
- Location: Mannheim, Germany
- Contact:
Re: P192 clarification
I had no problem to understand it after your correction, when I read P192 for the first time.daniel.is.fischer wrote:Edit: I introduced the term "denominator bound", is that better?
- stijn263
- Posts: 1505
- Joined: Sat Sep 15, 2007 11:57 pm
- Location: Netherlands
Re: P192 clarification
Are there any solutions yet where everything fits into 64 bit integers and/or double precision floats ? All the approaches I can think of require either to multiply or to divide two 11 digit numbers..
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: P192 clarification
My solution fits in 64 bit integers. Excepting the denominators themselves, everything's 32 bits.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
- Tommy137
- Posts: 238
- Joined: Sun Feb 24, 2008 6:02 pm
- Location: Cologne, Germany
- Contact:
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: P192 clarification
I'll explain. Might take a moment, though.
Done, posted in the thread.
Done, posted in the thread.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
- stijn263
- Posts: 1505
- Joined: Sat Sep 15, 2007 11:57 pm
- Location: Netherlands
Re: P192 clarification
Don't feel like making a biginter class in C++ so I'm just going to let my program run overnight in Maple 
- sfabriz
- Posts: 175
- Joined: Thu Apr 06, 2006 12:18 am
- Location: London - UK
Re: P192 clarification
Can I ask a question?
Let suppose n=4850
using double precision (64 bit) I get sqrt(n) = 69,6419413859206
Now, my program evaluates this to have best approximation to:
67819583637568 / 973832467733 = 69,641941385920600000000000205374
If I use Biginteger, adding some precision, I get sqrt(n) = 69,641941385920596692338694642566468530971982030564030346201369
which yields as best approximation:
62831818251916 / 902212330695 = 69,641941385920596692338692931435
Let's check:
Now, as you can see the one I got using BigIntegers is far better. Is that correct? Because when I run my proggy on the examples I get everything right, but no way I can get the correct solution.
Cheers,
sfabriz
Let suppose n=4850
using double precision (64 bit) I get sqrt(n) = 69,6419413859206
Now, my program evaluates this to have best approximation to:
67819583637568 / 973832467733 = 69,641941385920600000000000205374
If I use Biginteger, adding some precision, I get sqrt(n) = 69,641941385920596692338694642566468530971982030564030346201369
which yields as best approximation:
62831818251916 / 902212330695 = 69,641941385920596692338692931435
Let's check:
Code: Select all
69,641941385920596692338692931435 (BigInteger)
69,641941385920600000000000205374 (double precision)
69,641941385920596692338694642566468530971982030564030346201369 (real value)Cheers,
sfabriz

- Tommy137
- Posts: 238
- Joined: Sun Feb 24, 2008 6:02 pm
- Location: Cologne, Germany
- Contact:
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: P192 clarification
Ever thought of using Java? Or GMP? But you don't need bignums, anywaystijn263 wrote:Don't feel like making a biginter class in C++ so I'm just going to let my program run overnight in Maple
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: P192 clarification
For those following this thread and who may not yet be aware of it, double precision floats (often referred as 64-bit floats) only have a precision of 53 bits, one of them being implied. One bit is used for the sign, and 11 bits used for the biased exponent.64 bit integers and/or double precision floats ?
In order to have 64-bit precision with floats, one needs to use extended double precision, i.e. 80-bit floats. (One bit is used for the sign, and 15 bits used for the biased exponent.)
When you assume something, you risk being wrong half the time.
- sfabriz
- Posts: 175
- Joined: Thu Apr 06, 2006 12:18 am
- Location: London - UK
Re: P192 clarification
Allright, thank you.Tommy137 wrote:902212330695 is correct.
Now I'm 1/99684 done with this problem...
Cheers

- Tommy137
- Posts: 238
- Joined: Sun Feb 24, 2008 6:02 pm
- Location: Cologne, Germany
- Contact:
Re: P192 clarification
It seems you solved it thoughsfabriz wrote:Allright, thank you.Tommy137 wrote:902212330695 is correct.
Now I'm 1/99684 done with this problem...
Cheers

- stijn263
- Posts: 1505
- Joined: Sat Sep 15, 2007 11:57 pm
- Location: Netherlands
Re: P192 clarification
My Maple program just finished, I was really happy my algorithm was correctdaniel.is.fischer wrote:Ever thought of using Java? Or GMP? But you don't need bignums, anywaystijn263 wrote:Don't feel like making a biginter class in C++ so I'm just going to let my program run overnight in Maple
However it seems almost all solutions use bignums..
- sfabriz
- Posts: 175
- Joined: Thu Apr 06, 2006 12:18 am
- Location: London - UK
Re: P192 clarification
Yep, my algo was correct, but I had 50 digits precision and it turned out they weren't enough. 60 have been good.Tommy137 wrote:It seems you solved it thoughsfabriz wrote:Allright, thank you.Tommy137 wrote:902212330695 is correct.
Now I'm 1/99684 done with this problem...
Cheers
Cheers

-
viv_ban
- Posts: 23
- Joined: Mon May 26, 2008 3:09 pm
prob-192(best rational approx)
can any one please confirm the answer for 1 <n <=1000
the answer generated by my program is equal to 610031050010701
thanks in advance
the answer generated by my program is equal to 610031050010701
thanks in advance
-
funktio
- Posts: 14
- Joined: Mon May 19, 2008 6:55 pm
- Location: Helsinki, Finland
Re: prob-192(best rational approx)
I get a slightly smaller number.
for($"=@_=split??,"Jrsk an treP rehlohacteu,";$";$\="\r"){$\.=$.=chr
32+95*rand,$_-$"or$.ne$_[--$"%2?-$"-1:$"]&&$"++for++$|..$";print}<>
32+95*rand,$_-$"or$.ne$_[--$"%2?-$"-1:$"]&&$"++for++$|..$";print}<>
-
viv_ban
- Posts: 23
- Joined: Mon May 26, 2008 3:09 pm
-
David F
- Posts: 23
- Joined: Sun Jul 20, 2008 11:03 pm