答案1
您可以(滥用)使用中定义的\pushQED
和结构:\popQED
amsthm
\documentclass{article}
\usepackage{amsmath,amsthm}
\theoremstyle{definition}
\newtheorem{probleminner}{Problem}
\newenvironment{problem}[1]
{\pushQED{\formatsource{#1}}\probleminner}
{\popQED\endprobleminner}
\newcommand{\formatsource}[1]{%
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill\quad
\mbox{\textup(\textit{#1}\textup)}%
}
\begin{document}
\begin{problem}{South Africa}
The sequence of positive integers $a_0,a_1,a_2,\dotsc$ satisfies
\[
a_{n+1}=\begin{cases}
\sqrt{a_{n}}, & \text{if $\sqrt{a_n}$ is an integer} \\
a_n+3, & \text{otherwise}
\end{cases}
\qquad
\text{for every $n\ge0$}.
\]
Determine all values of $a_0>1$ for which there exists at least
one number~$a$ such that $a_n=a$ for infinitely many values of~$n$.
\end{problem}
\end{document}
看https://tex.stackexchange.com/a/491666/4427有关\pushQED
和的信息\popQED
。该\formatsource
宏直接从复制而来\qed
。