## 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.
hk
Administrator
Posts: 11041
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

### Re: problem 065

A library is a set of routines to handle specific tasks, often in a separate file.
bigints are big integers (numbers).
pimspelier
Posts: 41
Joined: Tue Jan 21, 2014 2:06 pm
Location: The Netherlands

### Re: problem 065

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.
TexasRebel
Posts: 7
Joined: Sun Aug 02, 2015 8:14 pm

### Re: problem 065

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: 55
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

### Re: problem 065

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?
jaap
Posts: 555
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: problem 065

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: 55
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

### Re: problem 065

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?
jaap
Posts: 555
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: problem 065

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: 55
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

### Re: problem 065

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 11:58 am

### Re: problem 065

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.
jaap
Posts: 555
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: problem 065

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: 55
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

### Re: problem 065

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.
hk
Administrator
Posts: 11041
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

### Re: problem 065

Junglemath
Posts: 55
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

### Re: problem 065

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?
hk
Administrator
Posts: 11041
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

### Re: problem 065

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 .