Solving Recurrence equation for n

I have a recurrence equation tnt_n which is defined as

tn=2.5tn−1−1.5tn−4,for n≥5
t_n=2.5t_{n-1}-1.5t_{n-4},\qquad \text{for }n\geq5

Where
t1=5t2=10.5t3=26.25t4=62.625
\begin{align}
t_1&=5\\
t_2&=10.5\\
t_3&=26.25\\
t_4&=62.625
\end{align}

I need to solve my recurrence equation for nn when tn=13×1010t_n=13\times10^{10}. How can I achieve this in mathematica?

=================

  

 

Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Dr. belisarius
Feb 12 ’15 at 2:50

=================

2 Answers
2

=================

RSolve can provide an exact expression for t[n]

Clear[t];

t[n_] = t[n] /. RSolve[{t[1] == 5, t[2] == 21/2,
t[3] == 105/4, t[4] == 501/8,
t[n] == (5 t[n – 1] – 3 t[n – 4])/2},
t[n], n][[1]] // ToRadicals // Simplify

(1/219)(2^(1 – n)
(1 + (10 – Sqrt[73])^(1/3) +
(10 + Sqrt[73])^(1/3))^n*
(73 + (73*(5767 – 520*Sqrt[73]))^(1/3) +
(73*(5767 + 520*Sqrt[73]))^(1/3)) +
((1/4)(2 + (-1 – ISqrt[3])*
(10 – Sqrt[73])^(1/3) +
I*(I + Sqrt[3])(10 + Sqrt[73])^
(1/3)))^n(146 + I*(I + Sqrt[3])*
(73*(5767 – 520*Sqrt[73]))^(1/3) +
(-1 – ISqrt[3])
(73*(5767 + 520*Sqrt[73]))^(1/3)) +
((1/4)(2 + I(I + Sqrt[3])*
(10 – Sqrt[73])^(1/3) +
(-1 – ISqrt[3])(10 + Sqrt[73])^
(1/3)))^n*(146 + (-1 – ISqrt[3])
(73*(5767 – 520*Sqrt[73]))^(1/3) +
I*(I + Sqrt[3])*
(73*(5767 + 520*Sqrt[73]))^(1/3)))

Table[t[n], {n, 0, 5}] // N // Rationalize

{2, 5, 21/2, 105/4, 501/8, 2385/16}

FindRoot[t[n] == 13*^10, {n, 25}][[1]] // Chop // Quiet

n -> 28.6241

(t[#] // Chop) & /@ {28., 29.}

{7.54702*10^10, 1.80385*10^11}

LogPlot[{t[n] // Chop, 13*^10}, {n, 28, 29}]

t[1] = 5;
t[2] = 10.5;
t[3] = 26.25;
t[4] = 62.625;
t[n_Integer] := 2.5 t[n – 1] – 1.5 t[n – 4];

n = 5; While[t[n] < 13 10^10, Null; n++]; n (* 29 *)