The Typewriter Sequence

I drew the first 63 functions in the sequence to help me understand its convergences. It might help others as well to understand answers given above:

The typewriter sequence

Unfortunately, here I can only attach the rasterized format. In case someone wants to reproduce it, here is the Latex code:

\documentclass[9pt]{standalone}

\usepackage{bbm}
\usepackage{amsmath}
\usepackage{tikz,pgfplots}
\usetikzlibrary{arrows}

\newcommand{\nMAX}{63} 
\newcommand{\xGrSamp}{8} 

\begin{document}
\centering
\begin{tikzpicture}[font=\Large,shorten >=-2.5pt,shorten <=-2.5pt] 
\begin{axis}[
    axis x line*=bottom,
    axis y line*=right,
    axis z line*=left,  
    plot box ratio = 3 1000 2,
    view={.3}{.2},  
    xmin=-0.2,    xmax=1.25,         
    ymin=0.6,    ymax=\nMAX+0.3,                                 
    zmin=0,    zmax=1.0,
    xtick={0,1/8,2/8,3/8,4/8,5/8,6/8,7/8,1},
    xticklabels={$0$,$\frac{1}{2^3}$,$\frac{2}{2^3}$,$\frac{3}{2^3}$,$\frac{4}{2^3}$,$\frac{5}{2^3}$,$\frac{6}{2^3}$,$\frac{7}{2^3}$,$1$},
    ytick={0,...,\nMAX},    
    ztick={0,...,1.0},       
    xlabel=$x$,
    ylabel=$n$,
    zlabel=$f_n(x)$,
    x label style={at={(axis description cs:0.067,-0.001)},anchor=north},
    y label style={at={(axis description cs:0.062,0.145)},anchor=south},    
    z label style={at={(axis description cs:-0.002,0.035)},anchor=south},     
    yscale=5,
    xscale=5,
    legend entries={$f_n(x)=1\,$,
                    $f_n(x)=0\,$},
    legend style={rounded corners=3pt,at={(0.023,0.14)}},   
    legend style={nodes={scale=1.5, transform shape}},
    legend plot pos=right,
]
\foreach \n in {1, ..., \nMAX} 
{
    \pgfmathsetmacro\k{floor(log2(\n+1e-1))}
    \pgfmathsetmacro{\xm}{-0.2}
    \pgfmathsetmacro\xM{1.2}
    \pgfmathsetmacro\xa{(\n-(2^(\k)))/(2^(\k))}
    \pgfmathsetmacro\xb{(\n-(2^(\k))+1)/(2^(\k))}
    \edef\temp
    {
        \noexpand\coordinate (d1) at (axis cs:\xm,\n,0);
        \noexpand\coordinate (d2) at (axis cs:\xa,\n,0);    
        \noexpand\coordinate (d3) at (axis cs:\xa,\n,1);
        \noexpand\coordinate (d4) at (axis cs:\xb,\n,1);    
        \noexpand\coordinate (d5) at (axis cs:\xb,\n,0);        
        \noexpand\coordinate (d6) at (axis cs:\xM,\n,0);    
        \noexpand\coordinate (g0) at (axis cs:\xm,\n,1);
        \noexpand\coordinate (g1) at (axis cs:\xM,\n,1);                
    }
    \temp
    \draw[blue,<-o] (d1)--(d2);
    \draw[black,dashed,line width=0.04mm] (d2)--(d3);
    \draw[red,*-*]   (d3)--(d4);
    \draw[black,dashed,line width=0.04mm] (d4)--(d5);       
    \draw[blue,o->] (d5)--(d6); 
    \draw[black,dashed,line width=0.04mm] (g0)--(g1);   
}
\pgfplotsinvokeforeach{0, ..., \xGrSamp} 
{
    \draw[black,dashed,line width=0.06mm] (axis cs:#1/\xGrSamp,0,0)--(axis cs:#1/\xGrSamp,\nMAX,0);
}   
\addlegendimage{no markers,red}
\addlegendimage{no markers,blue}
\end{axis}
 \node[rectangle,draw,rounded corners=3pt,text width=7.7cm] at (29.3,1.7) 
 {\huge Typewriter Sequence: \\$f_n(x)={\mathbbm{1}}_{[\frac{n-2^k}{2^k},\frac{n-2^k+1}{2^k}]},$\\
    $\forall\, k\geq 0\,\, \&\,\, 2^k\leq n<2^{k+1} $};
\end{tikzpicture}

\end{document}

Note that at any choice of $x$ and for any integer $N$, there is an $n>N$ with $f_n(x)=1$. So, the numerical sequence $f_n(x)$ cannot converge to $0$.

Note, however, that we can certainly select a subsequence of this sequence of functions that converges pointwise a.e.


Draw a picture of the generic function $f_n$ in the typewriter sequence. It's a rectangle of height 1 over an interval of width $1/2^k$, with value zero elsewhere. As the sequence progresses, the rectangles slide across the unit interval, the way a typewriter moves across the page. At each 'carriage return' of the typewriter, a new row of rectangles starts, each rectangle having half the width as before. You can see that for every point $x$ in the unit interval, the sequence $f_n(x)$ takes values zero and one infinitely often, so $f_n(x)$ cannot converge to any number.