The Typewriter Sequence The typewriter sequence is an example of a sequence which converges to zero in measure but does not converge to zero a.e.
Could someone explain why it does not converge to zero a.e.?

$f_n(x) = \mathbb 1_{\left[\frac{n-2^k}{2^k}, \frac{n-2^k+1}{2^k}\right]} \text{, where } 2^k \leqslant n < 2^{k+1}.$

Note: the typewriter sequence (Example 7).
 A: I wrote this sequence of functions as a counterexample for a question that was deleted.
$$
f_n(x)=\left[\frac km\le x\lt\frac{k+1}m\right]
$$
where $[\dots]$ are Iverson brackets, $m=\left\lfloor\frac{1+\sqrt{1+8n}}2\right\rfloor$ and $k=n-\frac{m(m-1)}2$.
The Typewriter Sequence is a subsequence of this sequence (when $m$ is a power of $2$). Like the Typewriter Sequence, this sequence does not tend to $0$ pointwise, but its $L^1$ norms vanish.

A: 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:

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}

A: Animated visual demonstration

As the sequence progresses, the indicator functions move from left to right over $[0,1]$ and then half in width, when they reach the end, and then repeat this ad infinitem. But then, each left-to-right run of a particular width must, at some point, have a value of $1$ for every $x$ in the interval. Therefore, throughout the infinitely many left-to-right runs, every $x$ attains a value of $1$ infinitely many times. But since $x$ is usually $0$, it must have no pointwise limit.
On the other hand, the width of the interval over which each function is $1$ decreases to $0$, and the functions are eventually infinitesimally thin spikes. So their 'size' (both in terms of $L^1$ norm and measure) converges to zero.
This also explains the origin of the sequence's name, as it looks like the a typewriter's carriage return jumping it back to where it started.


I wrote the sequence in Desmos by using  $\frac{\operatorname{sign}\left(x-c\right)+1}{2}=\textbf{1}_{(c,\infty)}$, except at $x=c$, where it is $0.5$, and $1-\operatorname{sign}(x-c)^2=\begin{cases}1,&x=c\\0,&\text{else}\end{cases}$. This gives an expression for the functions in terms of the $\operatorname{sign}(\cdot)$ function, which can be interpreted by the program and can be simplified into the form in the animation above. A link to the project is available here.
A: 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.
A: 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.
A: The set on which ${f_n}$ fails to converge to $0$ is exactly $[0, 1]$, which has full measure $1$. To see this, note that the interval $[0, 1]$ is repeatedly overwritten by indicator functions of intervals with decreasing length($1/2$, $1/4$, ... and so on). Since any point in $[0, 1] $is covered infinitely many times by such intervals, they oscillate between $0$ and $1$ infinitely often as $n \to \infty$.
The "overwriting" nature is what prevent the sequence from converging a.e, while the sequence ${f_n := \frac{1}{n} 1_{[0,n]}}$ does converge to $0$ a.e.(actually it converges uniformly.)
