# 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..

edit retag close merge delete

Please 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.

( 2018-11-06 21:10:42 +0200 )edit

There 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.

( 2018-11-07 17:18:34 +0200 )edit

Of 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.

( 2018-11-08 17:35:58 +0200 )edit

Sort by » oldest newest most voted

Searching the numerators and denominators in the Online encyclopedia of integer sequences (OEIS):

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.

more

1

For 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).

( 2018-11-07 19:40:18 +0200 )edit