How do you write this in LaTeX:

I had the same problem with the actuarial symbol and the subscript/superscript, sooo I made a package to make my life easier and help other.
Plus, I’ve add some shortcut to save time.
The project page and the CTAN.
All you need is the actuarialsymbol package.
At the beginning of the code you have to write
\usepackage{actuarialsymbol}
For the sub/superscript
\actsymb['subscripLeft']['superscriptL']{<middle>}{'subscriptR'}{'superscriptR'}
Example of output:
In the thread Actuarial & Annuity notation in LaTeX from text.comp.tex, Donald Arseneau provided the following \annu command:
\def\annu#1{_{%
\vbox{\hrule height .2pt
\kern 1pt
\hbox{$\scriptstyle {#1}\kern 1pt$}%
}\kern-.05pt
\vrule width .2pt
}}
with the additional comment:
Tweak ".2pt" and "1pt" for appearance.
I suggest to google for "actuarial" symbols and, of course, "LaTeX". You will find lots of examples, e.g. Annuity or Angle Operation Symbol in LaTeX.
I solved that problem some years ago, if I only remembered the context. . .
EDIT
Some years later: There is a package for the actuarial angle, now in version 2: https://ctan.org/pkg/actuarialangle
You need the actuarialange package.
At the beginning of the code, you have to write
\usepackage{actuarialangle}
Then in math mode, to make the subscript “n” with the actuarial angle, you have to use one of these three commands:
\actuarialangle{n}
\angl{n}
\angln
Then for your task, the command is:
\[
a_{\actuarialangle{n}}
\]
Or if you want to write also the interest rate “i” the command is
\[
a_{\actuarialangle{n}i}
\]
Here's an example: in the tabular, the construction appears at natural size, but the commands should be used as subscripts like in the display.
\documentclass{article}
\usepackage{actuarialangle}
\begin{document}
\begin{tabular}{ll}
\verb|\actuarialangle{n}| & $\actuarialangle{n}$ \
\verb|\angl{n}| & $\angl{n}$ \
\verb|\angln| & $\angln$
\end{tabular}
[
a_{\actuarialangle{n}} \qquad a_{\actuarialangle{n}i}
]
\end{document}
\documentclass{article}
\usepackage{amsmath,amssymb,actuarialangle}
%amssymb is needed for the urcorner symbol OR actuarialangle for the taller version
%following two lines are only for this demo
\usepackage[]{graphicx}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
\centering
\includegraphics[scale=0.4]{Actuarial_notation}\\
Actuarial notation from \url{https://en.wikipedia.org/wiki/Actuarial_notation}\\
\vspace{0.4 cm}
%This is the full urcorner template to be reduced as one desires (see a typical example below)
$m\mkern-8mu{\raisebox{0.8em}2} \vert
\bar{\raisebox{0.5em}{\large{A}}}{\raisebox{0.8em}1}$
$\mkern-12mu{\raisebox{-0.0em}{\textit{x:n}}\mkern-8mu\big\urcorner}$
\vspace{0.4cm}
or for actuarialangle version
\vspace{0.4cm}
%This is the full Actuarialangle template to be reduced as one desires (see a typical example below)
$m\mkern-8mu{\raisebox{0.8em}2} \vert{\bar{\raisebox{0.5em}{\large{A}}}{\raisebox{0.8em}1}\mkern-10mu{x\mkern-4mu:\mkern-4mu\actuarialangle{n}}}$
\vspace{0.4cm}
or for a n other example
\vspace{0.4cm}
% bar A changed to ddot a, and several ''terms'' removed
$\ddot{\raisebox{0.4em}{{a}}}$$\raisebox{-0.0em}{\textit{x:n}}\mkern-8mu\big\urcorner$\\
$\ddot{a}_{x:\actuarialangle{n}} $
\vspace{0.4cm}
These are here as simple snippets to adjust rather than have to start from fresh
\end{document}