Difference between revisions of "Recursion"

m (added internal links)
m (internalized links)
Line 5: Line 5:
 
== Examples ==
 
== Examples ==
  
* A combinatorical use of recursion: [http://www.artofproblemsolving.com/Forum/viewtopic.php?p=448525#p448525 AIME 2006I/11]
+
* A combinatorical use of recursion: [[2006_AIME_I_Problems#Problem_11]]
* Use of recursion to compute an explicit formula: [http://www.artofproblemsolving.com/Forum/viewtopic.php?p=449173#p449173 AIME 2006I/13]
+
* Use of recursion to compute an explicit formula: [[2006_AIME_I_Problems#Problem_13]]
  
 
=== See also ===
 
=== See also ===

Revision as of 10:00, 14 July 2006

Recursion is a method of defining something (usually a sequence or function) in terms of previously defined values. The most famous example of a recursive definition is that of the Fibonacci sequence. If we let $F_n$ be the $n$th Fibonacci number, the sequence is defined recursively by the relations $F_0 = F_1 = 1$ and $F_{n+1}=F_{n}+F_{n-1}$. (That is, each term is the sum of the previous two terms.) Then we can easily calculate early values of the sequence in terms of previous values: $\displaystyle F_0=1, F_1=1, F_2=2, F_3=3, F_4=5, F_5=8$, and so on.

Often, it is convenient to convert a recursive definition into a closed-form definition. For instance, the sequence defined recursively by $\displaystyle a_0 = 1$ and $a_n = n\cdot a_{n - 1}$ for $n > 0$ also has the closed-form definition $\displaystyle a_n = n!$ (where "!" represents the factorial function).

Examples

See also