Ask Your Question

finding general term of a sequence

asked 2018-11-06 10:04:32 -0600

Kuldeep gravatar image

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 flag offensive 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.

dan_fulea gravatar imagedan_fulea ( 2018-11-06 14:10:42 -0600 )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.

dazedANDconfused gravatar imagedazedANDconfused ( 2018-11-07 10:18:34 -0600 )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.

slelievre gravatar imageslelievre ( 2018-11-08 10:35:58 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-06 18:49:56 -0600

slelievre gravatar image

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.

edit flag offensive delete link more



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).
mforets gravatar imagemforets ( 2018-11-07 12:40:18 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-11-06 10:04:32 -0600

Seen: 56 times

Last updated: Nov 06