Page 2 of 2

Re: problem 065

Posted: Sat Mar 22, 2014 9:23 am
by hk
A library is a set of routines to handle specific tasks, often in a separate file.
bigints are big integers (numbers).

Re: problem 065

Posted: Sat Mar 22, 2014 9:26 am
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.

Re: problem 065

Posted: Tue Aug 11, 2015 5:43 pm
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.

Re: problem 065

Posted: Fri Jan 31, 2020 9:02 am
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?

Re: problem 065

Posted: Fri Jan 31, 2020 9:31 am
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,...}

Re: problem 065

Posted: Fri Jan 31, 2020 9:51 am
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?

Re: problem 065

Posted: Fri Jan 31, 2020 12:44 pm
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.

Re: problem 065

Posted: Fri Jan 31, 2020 8:43 pm
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. 👍👍

Re: problem 065

Posted: Sun Feb 02, 2020 11:18 pm
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.

Re: problem 065

Posted: Mon Feb 03, 2020 6:49 am
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.

Re: problem 065

Posted: Mon Feb 03, 2020 1:59 pm
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.

Re: problem 065

Posted: Mon Feb 03, 2020 2:14 pm
by hk

Re: problem 065

Posted: Mon Feb 03, 2020 2:18 pm
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?

Re: problem 065

Posted: Mon Feb 03, 2020 3:14 pm
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 .