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.

2940 questions
647
votes
8 answers

Why is $1 - \frac{1}{1 - \frac{1}{1 - \ldots}}$ not real?

So we all know that the continued fraction containing all $1$s... $$ x = 1 + \frac{1}{1 + \frac{1}{1 + \ldots}}. $$ yields the golden ratio $x = \phi$, which can easily be proven by rewriting it as $x = 1 + \dfrac{1}{x}$, solving the resulting…
45
votes
1 answer

Limit associated with a recursion

Update: a full solution to the recursion below has now been found, and it is discussed here. If $z_n < 2y_n$ then $y_{n+1} = 4y_n - 2z_n$ $z_{n+1} = 2z_n + 3$ Else $y_{n+1} = 4y_n$ $z_{n+1} = 2 z_n - 1$ Consider the following…
35
votes
1 answer

Show that the maximum value of this nested radical is $\phi-1$

I was experimenting on Desmos (as usual), in particular infinite recursions and series. Here is one that was of interest: What is the maximum value of $$F_\infty=\sqrt{\frac{x}{x+\sqrt{\dfrac{x^2}{x-\sqrt{\dfrac{x^3}{x+ \sqrt{…
28
votes
2 answers

Does this sequence always terminate or enter a cycle?

I've been fiddling with the recursive sequence defined as follows: $$\begin{equation} f_n=\begin{cases} a, & n=1.\\ b, & n=2.\\ c, & n=3.\\ f_{n-1}f_{n-2}f_{n-3} \mod[f_{n-1}+f_{n-2}+f_{n-3}], & n>3. \end{cases} \end{equation}$$ And no…
27
votes
0 answers

What functions from $\Bbb N\to\Bbb N$ can be made from $+$, $-$, $\times$, $\div$, exponentiation, and $\lfloor\cdot\rfloor$?

What functions from $\Bbb N\to\Bbb N$ can be made from $+$, $-$, $\times$, $\div$, exponentiation, and $\lfloor\cdot\rfloor$? Call this class of functions $\mathcal Flex$ (for "floor and exponentiation"). The $\rm mod$ function…
25
votes
4 answers

Ackermann Function primitive recursive

I am reading the wikipedia page on ackermann's function, http://en.wikipedia.org/wiki/Ackermann_function And I am having trouble understanding WHY ackermann's function is an example of a function which is not primitive recursive. I understand that…
25
votes
4 answers

Minimal path to touch every square's area in an n by n grid

Consider an $n$ by $n$ square subdivided into unit squares. What is the shortest path you can take through the square that touches every unit square? Touching the edges/vertices of the squares is sufficient, the path can be of any shape, with any…
22
votes
7 answers

Definition of General Associativity for binary operations

Let's say we are talking about addition defined in the real numbers. Then, by induction we define $\sum_{i=0}^{0}a_i=a_0$ and $\sum_{i=0}^{n}a_i=\sum_{i=0}^{n-1}a_i+a_n$ for $n> 1.\:$ Now, how do you define general associativity? I know that this…
Daniela Diaz
  • 4,108
21
votes
4 answers

Recursive Integration over Piecewise Polynomials: Closed form?

Is there a closed form to the following recursive integration? $$ f_0(x) = \begin{cases} 1/2 & |x|<1 \\ 0 & |x|\geq1 \end{cases} \\ f_n(x) = 2\int_{-1}^x(f_{n-1}(2t+1)-f_{n-1}(2t-1))\mathrm{d}t $$ It's very clear that this converges against some…
20
votes
1 answer

The problem of the most visited point.

Represent the set $R_{n\times n}=\{1,2,\ldots, n\}\times\{1,2,\ldots, n\} $ as a rectangle of $n$ by $n$ points as in the figures below for example. How to calculate the number of circuits that visit a chosen point in this rectangle? What is the…
19
votes
4 answers

Find all bijections $\,\,f:[0,1]\rightarrow[0,1],\,$ which satisfy $\,\,f\big(2x-f(x)\big)=x$.

A friend of mine gave me the following problem: Find all functions $f:[0,1]\to[0,1]$, which are one-to-one and onto and satisfy the following functional relation: $$ f\big(2x-f(x)\big)=x, \tag{1} $$ for all $x\in [0,1]$. Clearly, the identity…
19
votes
1 answer

Primitive recursive function which isn't $\Delta_0$

What is the simplest/cutest example (and/or example with the most student-friendly proof that it is an example) of a primitive recursive function which isn't representable by a $\Delta_0$ wff?
Peter Smith
  • 56,527
18
votes
2 answers

Finding expected value with recursion

We'll start off with an example of a question of finding expected value. What is the expected number of tries to get $6$ when rolling dice? $$ \mathbb{E}[x] =1/6*1 + 5/6 * (1+\mathbb{E}[x]) \implies \mathbb{E}(x)=6 $$ I understand the intuition,…
hans-t
  • 457
18
votes
4 answers

What is the closed form of the $f$ with $f(1)=1$, $f(2)=7$ and $f(n)=7f(n-1)-12f(n-2)$ ($n\ge 3$)?

Suppose $f(1)=1$ and $f(2)=7$. For $n\ge 3$ we have $$f(n)=7f(n-1)-12f(n-2). $$ What is the closed form of the function $f$? I've tried unrolling it but it gets very complicated very quickly without a clear pattern emerging. Any ideas?
user686717
17
votes
2 answers

Growth rate of the nth natural number not constructable with n steps of addition and multiplication

While messing around with the idea of ordinal collapsing functions, I stumbled upon an interesting simple function: $$C(0)=\{0,1\}\\C(n+1)=C(n)\cup\{\gamma+\delta:\gamma,\delta\in C(n)\}\\\psi(n)=\min\{k\notin C(n),k>0\}$$ The explanation is simple.…
1
2 3
99 100