This list is given by $$ a_1 = 2, a_2 = 3, a_n = 2 \dfrac{a_{n-1}}{a_{n-2}} + 3a_{n-1}, \text{ for } n>2 $$

Find the 30th element of the list. Print the first 20 elements in a table and sort them in descending order.

Please help me how to begin. I have not been working with this program for a long time. Tell me how to input the given and get the elements in a table in descending order.

  • 2
    $\begingroup$ Think about how you would write a factorial function given its recursive definition n! = n * (n-1)!. $\endgroup$ – Rohit Namjoshi Sep 3 at 15:08
  • 3
    $\begingroup$ Take a look at Sort/ReverseSort, RecurrenceTable and this tutorial. If you have tried a few things and you're still unsuccessful, feel free to update the question with some of your attempts. $\endgroup$ – Lukas Lang Sep 3 at 19:06
  • $\begingroup$ Your list seems not to converge. Might it be something like $ a_n = 2 \dfrac{a_{n-1}}{a_{n-2}} + 3 $? $\endgroup$ – Αλέξανδρος Ζεγγ Sep 5 at 7:48

You can define recursive functions almost exactly the way you have written it in your question:

a[n_] := a[n] = 2 a[n - 1]/a[n - 2] + 3 a[n - 1];
a[1] = 2; 
a[2] = 3;

Now you can find the 30th element by typing


and you can find a range of values:


Use Sort to sort them.

  • $\begingroup$ Thank you for helping but it does not come correct.I might write it inncorect,so I edited it now.They are subscripts of a. $\endgroup$ – User Sep 4 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.