This is a supplement to the answers of Lin and Stekelenberg. It describes an observation I made in conversation with Andrej Bauer and Martín Escardó in 2007, which may well be known to others.

In addition to realizability toposes, there are Grothendieck toposes in which the functor $2^{2^{(-)}}$ has an initial algebra. A nice example is given by Johnstone's topological topos, where the carrier object of the initial algebra is the natural numbers object $N$.

This works as follows. The objects $N$, $2^N$ and $2^{2^N}$ all reside in the subcategory of the topological topos corresponding to sequential topological spaces. $N$ is the natural numbers with discrete topology. $2^N$ is a countable power of $2$, which has the product topology; i.e., it is Cantor space. $2^{2^N}$ is the set of clopen sets in Cantor space, with discrete topology. Via Stone duality, the clopen sets of Cantor space form the free boolean algebra on countably many generators, and there are thus countably many of them. Thus $2^{2^N}$ is isomorphic to $N$.

To describe the initial algebra consider any bijection: $$\phi: N \to 2^{2^N}$$ satisfying the property that the modulus of uniform continuity of $\phi(n)$ is always $\leq n$. (Here the *modulus of uniform continuity* of a continuous $C: 2^N \to N$ is the smallest $m$ such that $C(\alpha)$ is always determined by the values of $\alpha$ on $\{0, \dots, m-1\}$.) Such a $\phi$ is easy to construct. The inverse $$\phi^{-1}: 2^{2^N} \to N$$ then provides an initial algebra.

To verify initiality, given an algebra $f: 2^{2^X} \to X$ one needs to
construct the unique homomorphism $h: N \to X$. The homomorphism property gives the following recursive equation for $h$
$$h(n) = f(\lambda p. \phi(n)(\lambda m. p(h(m))))$$
which is then well-defined and uniquely determined by induction on $n$, using the assumed property of $\phi$. (I am treating the sheaf $X$ as a set, which is fine since the formula defines $h$ in the internal logic of the topos.)

Three further remarks: Identical reasoning shows that the natural numbers carry the initial algebra for $2^{2^{(-)}}$ in the usual cartesian closed categories of topological spaces. Also, a purely category-theoretic argument shows that when $\phi$ is an initial algebra then $2^\phi$ is a final coalgebra, hence Cantor space carries the final coalgebra. (This can also be proved directly, using an argument similar to that above for the initiality of $\phi$.) Finally, a natural level of generality for the argument above is: in any elementary topos with natural numbers object in which the "fan theorem" holds, the definition of $\phi^{-1}: 2^{2^N} \to N$ above is an initial algebra for $2^{2^{(-)}}$.