Questions tagged [recursion]

Recursion is the process of repeating items in a self-similar way. A recursive definition (or inductive definition) in mathematical logic and computer science is used to define an object in terms of itself. A recursive definition of a function defines values of a function for some inputs in terms of the values of the same function on other inputs. Please use the tag 'computability' instead for questions about "recursive functions" in computability theory

Recursion is the process of repeating items in a self-similar way. The most common application of recursion is in mathematics and computer science, in which it refers to a method of defining functions in which the function being defined is applied within its own definition.

Basically, a class of objects exhibiting recursive behaviour can be characterised by two features:

  • There must be a base criterion for which the function should not call itself.

  • Every other iteration of the function should move it closer to the base condition.

2553 questions
10
votes
3 answers

$ \int_0^\frac{\pi}{2}\ln^n\left(\tan(x)\right)\:dx$

I'm currently working on a definite integral and am hoping to find alternative methods to evaluate. Here I will to address the integral: \begin{equation} I_n = \int_0^\frac{\pi}{2}\ln^n\left(\tan(x)\right)\:dx \end{equation} Where $n \in…
10
votes
1 answer

$I_n(t,a) = \int_0^\infty \frac{\cos(xt)}{\left(x^2 + a^2\right)^n}\:dx$

Spurred on by this, here I'm hoping to resolve the following integral: \begin{equation} I_n(a,t) = \int_0^\infty \frac{\cos(xt)}{\left(x^2 + a^2\right)^n}\:dx \end{equation} Where $a,t \in \mathbb{R}^+$ and $n \in \mathbb{N}$. To begin with we…
10
votes
1 answer

Optimal stopping in red vs black card game deck of 52 cards

I have a optimal stopping problem that is solved by recursion. I was stumped by this question in an interview once. I am hoping someone can walk me through the reasoning so I can reproduce it on similar problems. Imagine you are playing a card game…
10
votes
4 answers

Toward Explicit Formula from Recursion : Is Generating function "the only" answer?

I am trying to draw the explicit formula of $S_n$ that is defined as below: $S_n$ is the number of words of length n using 0,1 and 2 such that no two consecutive 0's occur. Myself, as I had learned from the basic skills in combinatorics, just…
10
votes
1 answer

Moving bricks into piles

Suppose we have $k$ piles, into which we would like to distribute $n$ bricks. Initially, all $n$ bricks are stacked in pile $1$. A move consists of moving one brick from pile $i$ to pile $j$, $1\le i,j\le k$. A move is valid only if $$ |i| > |j|+1…
Steve D
  • 3,076
  • 2
  • 10
  • 23
10
votes
3 answers

How to determine the outcome of the recursive sequence $a_n=\frac{1}{\operatorname{abs}\left(a_{n-1}\right)-1}$

Depending on the starting value, the end result of this iterative sequence appears to be very variable, for example, if the starting value $a_0\ =\frac{b}{c}$ where $b$ and $c$ are integers, then eventually the sequence appears to always reach 0,…
Cubbs
  • 809
  • 9
  • 18
10
votes
3 answers

How can I explain this integer partitions function recursion?

How to explain how this algorithm works? I need to write an article about this but I can't explain why this recursion works fine. It defines the number of partitions of a given integer function p(sum,largest): if largest==0: return 0 if…
Lucas C. Feijo
  • 211
  • 2
  • 5
10
votes
4 answers

How to find explicit formula for two recursions?

I have to find explicit solution for two intertwining recursions $$\begin{align} f(n)&=f(n-2)+2g(n-1) \\ g(n)&=g(n-2)+f(n-1) \end{align}$$ for $f(0)=1, f(1)=0, g(0)=0 ,g(1)=1$. What techniques are commonly used for this types of problem? Thanks!
10
votes
3 answers

How many permutations of $\{1,2,3,...,n\}$ there are with no 2 consecutive numbers?

How many permutations of $\{1,2,3,...,n\}$ are there with no 2 consecutive numbers? For example: $n=4$, $2143$, $3214$, $1324$ are the permutations we look for and $1234$, $1243$, $2134$ are what we DON'T look for. My solution: we will sub from all…
10
votes
1 answer

Limit of recursive sequence $n^2q_n=1+(n-1)^2q_{n-1}+2(n-2)q_{n-2}$

When looking at this riddle, I came across the following sequence for the frequency of sampled integers between 1 and $n$ in a without replacement/without neighbour sampling: $$q_1=1,\quad q_2=1/2,\quad…
10
votes
1 answer

Solving a recursion efficiently

I have a recursive formula $$v(n+1) = v(n)\dfrac{1+v(n-1)-n}{1+v(n-1)-v(n)}$$ and I also know $$v(1)=2v(0)$$ $$n+1 \le v(n+1) \le v(n)+1.$$ I wish to find, for example, $v(10)$ more efficiently than my current method does. That involves using the…
Henry
  • 142,043
  • 9
  • 114
  • 228
10
votes
1 answer

Bell numbers, recursions, bijections

The $n$th Bell number, named after Eric Temple Bell (although he was far from the first to think about them), is the number of partitions of a set of cardinality $n$. If they are written in the top row of this triangle, starting with the $0$th Bell…
Michael Hardy
  • 1
  • 30
  • 276
  • 565
9
votes
3 answers

Repertoire method for solving recursions

I am trying to solve this four parameter recurrence from exercise 1.16 in Concrete Mathematics: \[ g(1)=\alpha \] \[ g(2n+j)=3g(n)+\gamma n+\beta_j \] \[ \mbox{for}\ j=0,1\ \mbox{and}\ n\geq1 \] I have assumed the closed form to be: $$g(n) =…
9
votes
4 answers

Is there a closed form formula for the recursive sequence: $x_n = x_{n-1} + \alpha\sqrt{x_{n-1}}$

I saw this link for closed form formula for a recursive sequence (How to derive a closed form of a simple recursion?) However, what if my formula is: $$x_n = x_{n-1} + \alpha\sqrt{x_{n-1}} \quad \text{ and } \quad x_0 = \beta \quad \text{ and…
9
votes
2 answers

A known closed form for Borchardt mean (generalization of AGM) - why doesn't it work?

There is a curious four parameter iteration introduced by Borchardt: $$a_{n+1}=\frac{a_n+b_n+c_n+d_n}{4} \\ b_{n+1}=\frac{\sqrt{a_n b_n}+\sqrt{c_n d_n}}{2} \\ c_{n+1}=\frac{\sqrt{a_n c_n}+\sqrt{b_n d_n}}{2} \\ d_{n+1}=\frac{\sqrt{a_n d_n}+\sqrt{b_n…