ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 08 Nov 2018 10:35:58 -0600finding general term of a sequencehttp://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/ I have a sequence of numbers $1,\dfrac{3}{4},\dfrac{11}{36},\dfrac{25}{288},\dfrac{137}{7200},\ldots$. Now can we have a sage code that can give the $n$ th term of this sequence..Tue, 06 Nov 2018 10:04:32 -0600http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/Comment by slelievre for <p>I have a sequence of numbers $1,\dfrac{3}{4},\dfrac{11}{36},\dfrac{25}{288},\dfrac{137}{7200},\ldots$. Now can we have a sage code that can give the $n$ th term of this sequence..</p>
http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44225#post-id-44225Of course there are infinitely many ways to continue a sequence.
One can still understand the question as "Find a reasonable guess of
what this sequence might be, and give the next term for that guess".
The Online encyclopedia of integer sequences (OEIS) has a collection
of such reasonable guesses.Thu, 08 Nov 2018 10:35:58 -0600http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44225#post-id-44225Comment by dazedANDconfused for <p>I have a sequence of numbers $1,\dfrac{3}{4},\dfrac{11}{36},\dfrac{25}{288},\dfrac{137}{7200},\ldots$. Now can we have a sage code that can give the $n$ th term of this sequence..</p>
http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44214#post-id-44214There is no "the nth term" for a sequence like you've given with ... . For example: 1,2,3,.... could be the sequence f(n)=n or it could be f(n)=n^3-6n^2+12n-6. There are actually an infinite number of formulas that could work here.Wed, 07 Nov 2018 10:18:34 -0600http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44214#post-id-44214Comment by dan_fulea for <p>I have a sequence of numbers $1,\dfrac{3}{4},\dfrac{11}{36},\dfrac{25}{288},\dfrac{137}{7200},\ldots$. Now can we have a sage code that can give the $n$ th term of this sequence..</p>
http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44209#post-id-44209Please give us the formula for the $n$.th term of this or an other sequence, we will try to implement it in one line. Else the question is not well defined.Tue, 06 Nov 2018 14:10:42 -0600http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44209#post-id-44209Answer by slelievre for <p>I have a sequence of numbers $1,\dfrac{3}{4},\dfrac{11}{36},\dfrac{25}{288},\dfrac{137}{7200},\ldots$. Now can we have a sage code that can give the $n$ th term of this sequence..</p>
http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?answer=44211#post-id-44211Searching the numerators and denominators in the Online encyclopedia of integer sequences (OEIS):
- numerators: https://oeis.org/search?q=1%2C+3%2C+11%2C+25%2C+137
- denominators: https://oeis.org/search?q=1%2C+4%2C+36%2C+288%2C+7200
the sequence might be $u_n = H(n) / n!$ where $H(n) = \sum_{k = 1 .. n} 1/k$
is the $n$-th harmonic number.
sage: def u(n):
....: return sum(1/i for i in (1 .. n))/factorial(n)
....:
sage: [u(n) for n in (1 .. 8)]
[1, 3/4, 11/36, 25/288, 137/7200, 49/14400, 121/235200, 761/11289600]
There are of course many other "natural" possibilities.Tue, 06 Nov 2018 18:49:56 -0600http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?answer=44211#post-id-44211Comment by mforets for <p>Searching the numerators and denominators in the Online encyclopedia of integer sequences (OEIS):</p>
<ul>
<li>numerators: <a href="https://oeis.org/search?q=1,+3,+11,+25,+137">https://oeis.org/search?q=1%2C+3%2C+1...</a></li>
<li>denominators: <a href="https://oeis.org/search?q=1,+4,+36,+288,+7200">https://oeis.org/search?q=1%2C+4%2C+3...</a></li>
</ul>
<p>the sequence might be $u_n = H(n) / n!$ where $H(n) = \sum_{k = 1 .. n} 1/k$
is the $n$-th harmonic number.</p>
<pre><code>sage: def u(n):
....: return sum(1/i for i in (1 .. n))/factorial(n)
....:
sage: [u(n) for n in (1 .. 8)]
[1, 3/4, 11/36, 25/288, 137/7200, 49/14400, 121/235200, 761/11289600]
</code></pre>
<p>There are of course many other "natural" possibilities.</p>
http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44215#post-id-44215For the OP: Sage ships with the command `oeis` to play with directly in the REPL, eg.
sage: oeis([1, 4, 36, 288, 7200], max_results=2)
0: A277174: a(n) = Product_{i=1..n} i*rad(i) where rad(n) = A007947(n).
1: A316297: a(n) = n! times the denominator of the n-th harmonic number H(n).Wed, 07 Nov 2018 12:40:18 -0600http://ask.sagemath.org/question/44203/finding-general-term-of-a-sequence/?comment=44215#post-id-44215