# Taking a long time to produce output

In the following, I want to know b[1000], but it is taking a very long time even for b[30].

a[0]=1.
a[n_]:=a[n - 1] + 1./ Sqrt[a[n - 1]];
b[n_] := (a[n])^3/n^2;
b[30]

• Every time you call b it is in turn calling a recursively. Try the simple change of a[n_]:=a[n]= this should run quite quickly even for large n. Though be warned that it will use up memory, since you are trading speed for storage here. See this for more details. reference.wolfram.com/language/tutorial/… – enano9314 Aug 27 '18 at 4:32
• @enano9314, Thanks a lot for your help – math Aug 27 '18 at 4:37

a[0] = 1.;