ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 03 Sep 2018 10:10:16 +0200How can I find the sum of fibonacci (1) + (2) + (4) + (7) + (11) + (16) + ... ?https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/ How can I find the sum of fibonacci (1) + (2) + (4) + (7) + (11) + (16) + ... ?
* The numbers in () means the terms of fibonacci sequenceSat, 18 Aug 2018 08:21:34 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/Answer by slelievre for <p>How can I find the sum of fibonacci (1) + (2) + (4) + (7) + (11) + (16) + ... ?</p>
<ul>
<li>The numbers in () means the terms of fibonacci sequence</li>
</ul>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?answer=43415#post-id-43415Sage provides `fibonacci` to access elements of the Fibonacci sequence.
This can be combined with basic list comprehension and sum.
So, you could do things like listing or summing consecutive terms:
sage: [fibonacci(j) for j in (0 .. 12)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
sage: sum(fibonacci(j) for j in (0 .. 12))
376
or non-consecutive terms:
sage: [fibonacci(j) for j in (1, 2, 4, 7, 11, 16)]
[1, 1, 3, 13, 89, 987]
sage: sum(fibonacci(j) for j in (1, 2, 4, 7, 11, 16))
1094
It seems the indices you are interested about are of the form $(n^2 + n + 2)/2$
sage: [(n^2 + n + 2)//2 for n in range(10)]
[1, 2, 4, 7, 11, 16, 22, 29, 37, 46]
so here are the terms of the Fibonacci sequence for these indices:
sage: [fibonacci((n^2 + n + 2)//2) for n in range(10)]
[1, 1, 3, 13, 89, 987, 17711, 514229, 24157817, 1836311903]
and here is their sum them up to some point:
sage: sum(fibonacci((n^2 + n + 2)//2) for n in range(10))
1861002754
and here is how this sum evolves when you push it further and further:
sage: [sum(fibonacci((j^2 + j + 2)//2) for j in range(n)) for n in range(10)]
[0, 1, 2, 5, 18, 107, 1094, 18805, 533034, 24690851]
Since all the Fibonacci numbers are at least one, if you add infinitely many of them,
the sum will tend to infinity.Sat, 18 Aug 2018 15:46:09 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?answer=43415#post-id-43415Comment by slelievre for <p>Sage provides <code>fibonacci</code> to access elements of the Fibonacci sequence.</p>
<p>This can be combined with basic list comprehension and sum.</p>
<p>So, you could do things like listing or summing consecutive terms:</p>
<pre><code>sage: [fibonacci(j) for j in (0 .. 12)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
sage: sum(fibonacci(j) for j in (0 .. 12))
376
</code></pre>
<p>or non-consecutive terms:</p>
<pre><code>sage: [fibonacci(j) for j in (1, 2, 4, 7, 11, 16)]
[1, 1, 3, 13, 89, 987]
sage: sum(fibonacci(j) for j in (1, 2, 4, 7, 11, 16))
1094
</code></pre>
<p>It seems the indices you are interested about are of the form $(n^2 + n + 2)/2$</p>
<pre><code>sage: [(n^2 + n + 2)//2 for n in range(10)]
[1, 2, 4, 7, 11, 16, 22, 29, 37, 46]
</code></pre>
<p>so here are the terms of the Fibonacci sequence for these indices:</p>
<pre><code>sage: [fibonacci((n^2 + n + 2)//2) for n in range(10)]
[1, 1, 3, 13, 89, 987, 17711, 514229, 24157817, 1836311903]
</code></pre>
<p>and here is their sum them up to some point:</p>
<pre><code>sage: sum(fibonacci((n^2 + n + 2)//2) for n in range(10))
1861002754
</code></pre>
<p>and here is how this sum evolves when you push it further and further:</p>
<pre><code>sage: [sum(fibonacci((j^2 + j + 2)//2) for j in range(n)) for n in range(10)]
[0, 1, 2, 5, 18, 107, 1094, 18805, 533034, 24690851]
</code></pre>
<p>Since all the Fibonacci numbers are at least one, if you add infinitely many of them,
the sum will tend to infinity.</p>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43558#post-id-43558I expanded my answer to address your comment.Sun, 02 Sep 2018 20:45:46 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43558#post-id-43558Comment by pizza for <p>Sage provides <code>fibonacci</code> to access elements of the Fibonacci sequence.</p>
<p>This can be combined with basic list comprehension and sum.</p>
<p>So, you could do things like listing or summing consecutive terms:</p>
<pre><code>sage: [fibonacci(j) for j in (0 .. 12)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
sage: sum(fibonacci(j) for j in (0 .. 12))
376
</code></pre>
<p>or non-consecutive terms:</p>
<pre><code>sage: [fibonacci(j) for j in (1, 2, 4, 7, 11, 16)]
[1, 1, 3, 13, 89, 987]
sage: sum(fibonacci(j) for j in (1, 2, 4, 7, 11, 16))
1094
</code></pre>
<p>It seems the indices you are interested about are of the form $(n^2 + n + 2)/2$</p>
<pre><code>sage: [(n^2 + n + 2)//2 for n in range(10)]
[1, 2, 4, 7, 11, 16, 22, 29, 37, 46]
</code></pre>
<p>so here are the terms of the Fibonacci sequence for these indices:</p>
<pre><code>sage: [fibonacci((n^2 + n + 2)//2) for n in range(10)]
[1, 1, 3, 13, 89, 987, 17711, 514229, 24157817, 1836311903]
</code></pre>
<p>and here is their sum them up to some point:</p>
<pre><code>sage: sum(fibonacci((n^2 + n + 2)//2) for n in range(10))
1861002754
</code></pre>
<p>and here is how this sum evolves when you push it further and further:</p>
<pre><code>sage: [sum(fibonacci((j^2 + j + 2)//2) for j in range(n)) for n in range(10)]
[0, 1, 2, 5, 18, 107, 1094, 18805, 533034, 24690851]
</code></pre>
<p>Since all the Fibonacci numbers are at least one, if you add infinitely many of them,
the sum will tend to infinity.</p>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43564#post-id-43564Thank you!Mon, 03 Sep 2018 10:10:16 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43564#post-id-43564Comment by pizza for <p>Sage provides <code>fibonacci</code> to access elements of the Fibonacci sequence.</p>
<p>This can be combined with basic list comprehension and sum.</p>
<p>So, you could do things like listing or summing consecutive terms:</p>
<pre><code>sage: [fibonacci(j) for j in (0 .. 12)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
sage: sum(fibonacci(j) for j in (0 .. 12))
376
</code></pre>
<p>or non-consecutive terms:</p>
<pre><code>sage: [fibonacci(j) for j in (1, 2, 4, 7, 11, 16)]
[1, 1, 3, 13, 89, 987]
sage: sum(fibonacci(j) for j in (1, 2, 4, 7, 11, 16))
1094
</code></pre>
<p>It seems the indices you are interested about are of the form $(n^2 + n + 2)/2$</p>
<pre><code>sage: [(n^2 + n + 2)//2 for n in range(10)]
[1, 2, 4, 7, 11, 16, 22, 29, 37, 46]
</code></pre>
<p>so here are the terms of the Fibonacci sequence for these indices:</p>
<pre><code>sage: [fibonacci((n^2 + n + 2)//2) for n in range(10)]
[1, 1, 3, 13, 89, 987, 17711, 514229, 24157817, 1836311903]
</code></pre>
<p>and here is their sum them up to some point:</p>
<pre><code>sage: sum(fibonacci((n^2 + n + 2)//2) for n in range(10))
1861002754
</code></pre>
<p>and here is how this sum evolves when you push it further and further:</p>
<pre><code>sage: [sum(fibonacci((j^2 + j + 2)//2) for j in range(n)) for n in range(10)]
[0, 1, 2, 5, 18, 107, 1094, 18805, 533034, 24690851]
</code></pre>
<p>Since all the Fibonacci numbers are at least one, if you add infinitely many of them,
the sum will tend to infinity.</p>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43424#post-id-43424I appreciate you for helping me.
However, what I want to do is not adding up continuous terms of the sequence.
I want to add the 1st, 2nd, 4th, 7th, 10th, ... positive fibonacci numbers, which you would notice,
+1 +2 +3 +4 +5
I know that this is not quite an easy question, so if you have time you could just give it a try.
THANK YOU!Mon, 20 Aug 2018 08:19:36 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43424#post-id-43424Answer by tmonteil for <p>How can I find the sum of fibonacci (1) + (2) + (4) + (7) + (11) + (16) + ... ?</p>
<ul>
<li>The numbers in () means the terms of fibonacci sequence</li>
</ul>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?answer=43420#post-id-43420The sum is infinite ! You have to ask more precise questions if you want an efficient answer. For exremely large numbers, you should notice that the fibonacci sequence is the difference between two geometric functions.Sun, 19 Aug 2018 14:27:53 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?answer=43420#post-id-43420Comment by pizza for <p>The sum is infinite ! You have to ask more precise questions if you want an efficient answer. For exremely large numbers, you should notice that the fibonacci sequence is the difference between two geometric functions.</p>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43425#post-id-43425Yes, I suppose that the question also wants me to add the numbers to infinity. But I guess adding up a certain amount of terms might be enough to estimate the sum of infinity of this sequence.Mon, 20 Aug 2018 08:24:44 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43425#post-id-43425Comment by pizza for <p>The sum is infinite ! You have to ask more precise questions if you want an efficient answer. For exremely large numbers, you should notice that the fibonacci sequence is the difference between two geometric functions.</p>
https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43426#post-id-43426Moreover, as I am a beginner in using sage programme. and I am not advance in maths (Sorry!), could you explain what kind of precise questions I should ask for you to answer my question?
Thanks!Mon, 20 Aug 2018 08:29:00 +0200https://ask.sagemath.org/question/43408/how-can-i-find-the-sum-of-fibonacci-1-2-4-7-11-16/?comment=43426#post-id-43426