problem 065

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
User avatar
hk
Administrator
Posts: 10706
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: problem 065

Post by hk »

A library is a set of routines to handle specific tasks, often in a separate file.
bigints are big integers (numbers).
Image

pimspelier
Posts: 41
Joined: Tue Jan 21, 2014 2:06 pm
Location: The Netherlands

Re: problem 065

Post by pimspelier »

Thanks again!

EDIT (18 april 2014):
As I've said before, Python is indeed a nice language, with many benefits. Except for it's capability with huge numbers, string handling is the best. For example, concatenating two numbers, a=12345,b=67890: int(str(a)+str(b)) #returns 1234567890. That's easier than something like a*(10^(digits(b)))+b in C.
Image

TexasRebel
Posts: 7
Joined: Sun Aug 02, 2015 7:14 pm

Re: problem 065

Post by TexasRebel »

Although, if you step up to c++ handling integers as strings is simplified greatly by using stringstreams.

concatenating long ints a = 12345 and b = 67890 is as simple as

ss << a << b;

which can be >> out to an unsigned long long int, string, or any container you choose to provide functionality with the >> operator.

Junglemath
Posts: 27
Joined: Fri Sep 20, 2019 12:25 pm

Re: problem 065

Post by Junglemath »

In the problem statement it lists 2k as one of the components of the continued fraction, but nowhere is it stated what k is. Help?

User avatar
jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: problem 065

Post by jaap »

Junglemath wrote:
Fri Jan 31, 2020 9:02 am
In the problem statement it lists 2k as one of the components of the continued fraction, but nowhere is it stated what k is. Help?
It is just there to indicate that the pattern shown in the first numbers continues. It shows what an arbitrary section of the list would look like. Here are some other examples of this notation:
{1,3,5,7,...,2k+1,...}
{1,2,4,8,...,2^k,...}
{1,10,1,20,1,30,1,40,...,1,10k,...}

Junglemath
Posts: 27
Joined: Fri Sep 20, 2019 12:25 pm

Re: problem 065

Post by Junglemath »

jaap wrote:
Fri Jan 31, 2020 9:31 am
Junglemath wrote:
Fri Jan 31, 2020 9:02 am
In the problem statement it lists 2k as one of the components of the continued fraction, but nowhere is it stated what k is. Help?
It is just there to indicate that the pattern shown in the first numbers continues. It shows what an arbitrary section of the list would look like. Here are some other examples of this notation:
{1,3,5,7,...,2k+1,...}
{1,2,4,8,...,2^k,...}
{1,10,1,20,1,30,1,40,...,1,10k,...}
So is the pattern that they are trying to convey

1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, ...

i.e. two 1s followed by the next even integer?

User avatar
jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: problem 065

Post by jaap »

Junglemath wrote:
Fri Jan 31, 2020 9:51 am
jaap wrote:
Fri Jan 31, 2020 9:31 am
Junglemath wrote:
Fri Jan 31, 2020 9:02 am
In the problem statement it lists 2k as one of the components of the continued fraction, but nowhere is it stated what k is. Help?
It is just there to indicate that the pattern shown in the first numbers continues. It shows what an arbitrary section of the list would look like. Here are some other examples of this notation:
{1,3,5,7,...,2k+1,...}
{1,2,4,8,...,2^k,...}
{1,10,1,20,1,30,1,40,...,1,10k,...}
So is the pattern that they are trying to convey

1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, ...

i.e. two 1s followed by the next even integer?
Exactly.

BTW, finite continued fractions are always rationals, and infinitely long continued fractions are always irrationals. So it is no surprise that e has an infinite continued fraction.
Periodic continued fractions (i.e. those that eventually repeat) are rational square root expressions, or rather, they are roots of a quadratic polynomial with rational coefficients. So it is again no big surprise that e's continued fraction does not repeat.
But it is surprising that e's continued fraction has a pattern to it at all.

Junglemath
Posts: 27
Joined: Fri Sep 20, 2019 12:25 pm

Re: problem 065

Post by Junglemath »

jaap wrote:
Fri Jan 31, 2020 12:44 pm
Junglemath wrote:
Fri Jan 31, 2020 9:51 am
jaap wrote:
Fri Jan 31, 2020 9:31 am


It is just there to indicate that the pattern shown in the first numbers continues. It shows what an arbitrary section of the list would look like. Here are some other examples of this notation:
{1,3,5,7,...,2k+1,...}
{1,2,4,8,...,2^k,...}
{1,10,1,20,1,30,1,40,...,1,10k,...}
So is the pattern that they are trying to convey

1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, ...

i.e. two 1s followed by the next even integer?
Exactly.

BTW, finite continued fractions are always rationals, and infinitely long continued fractions are always irrationals. So it is no surprise that e has an infinite continued fraction.
Periodic continued fractions (i.e. those that eventually repeat) are rational square root expressions, or rather, they are roots of a quadratic polynomial with rational coefficients. So it is again no big surprise that e's continued fraction does not repeat.
But it is surprising that e's continued fraction has a pattern to it at all.
Nice. Thanks. 👍👍

whatteaux
Posts: 7
Joined: Mon Sep 24, 2012 10:58 am

Re: problem 065

Post by whatteaux »

jaap wrote:
Fri Jan 31, 2020 12:44 pm
But it is surprising that e's continued fraction has a pattern to it at all.
Did you mmean Pi, rather than e? E's has a pattern (as shown in this thread), whereas Pi's is patternless.

User avatar
jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: problem 065

Post by jaap »

whatteaux wrote:
Sun Feb 02, 2020 11:18 pm
jaap wrote:
Fri Jan 31, 2020 12:44 pm
But it is surprising that e's continued fraction has a pattern to it at all.
Did you mmean Pi, rather than e? E's has a pattern (as shown in this thread), whereas Pi's is patternless.
I'm saying that you would not expect a pattern for e, so it is surprising that there is one.

Junglemath
Posts: 27
Joined: Fri Sep 20, 2019 12:25 pm

Re: problem 065

Post by Junglemath »

Another thing: is the 100th fraction supposed to be reduced to lowest terms before summing the numerator? I feel that this should be specified in the problem statement.

User avatar
hk
Administrator
Posts: 10706
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: problem 065

Post by hk »

Image

Junglemath
Posts: 27
Joined: Fri Sep 20, 2019 12:25 pm

Re: problem 065

Post by Junglemath »

hk wrote:
Mon Feb 03, 2020 2:14 pm
Here's some reading stuff:
https://math.stackexchange.com/question ... raction-al
Thanks, although isn't this considered a slight spoiler?

User avatar
hk
Administrator
Posts: 10706
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: problem 065

Post by hk »

I don't think so. These problems about continued fractions are meant to invite you to look up the concept.
E.g. from wikipedia. If you do so you will learn the things on the page I gave you fast enough .
Image

Post Reply