After proving the prime number theorem in class, our professor directs us to a remark by Lagrange that for large values of $x$, $\pi(x)$ is approximately equal to $$ \frac{x}{\log x - B}. $$ (This is from Ingham's Distribution of prime numbers, page 2). He then gave the following problem: prove that there is exactly one constant $B$ such that $$ \left|\pi(x)-\frac{x}{\ln x -B}\right| = O\left(\frac{x}{\ln^3 x}\right), $$ and that value is $1$.
Where do I start?
Since this question followed a proof of the prime number theorem I would conjecture that de la Vallée-Poussin's proof was exposed. One result of this method is following estimate of the error in the estimate $\;\pi(x)\sim\operatorname{Li}(x)$ as presented in Edwards' excellent "Riemann's zeta function" :
($c\,$ is a positive constant) $$\tag{1}\left|\frac{\pi(x)-\operatorname{Li}(x)}{x/(\log\,x)^2}\right|\le \frac{\operatorname{Li}(x)}{x}\frac{(\log\,x)^2}{\exp(\sqrt{c\;\log\,x})}$$
Since the logarithmic integral $\operatorname{Li}(x)$ admits the asymptotic expansion : $$\tag{2}\operatorname{Li}(x)\sim \frac x{\log x}+\frac {1!\,x}{(\log x)^2}+\frac {2!\,x}{(\log x)^3}$$ (as we may easily deduce by repetitive integration by parts of $\;\displaystyle \operatorname{Li}(x):=\operatorname{Li}(2)+\int_2^x\frac{dt}{\log t})\;$
we deduce that we have not only $\;\displaystyle\pi(x)\sim \frac x{\log x}\;$ from the PNT but also : $$\tag{3}\pi(x)\sim \frac x{\log x}+\frac x{(\log x)^2},\quad x\to \infty$$ From $(1)$ the difference between $\pi(x)$ and $\operatorname{Li}(x)$ can indeed be neglected compared to $\dfrac x{(\log x)^2}$
(since the RHS of $(1)$ goes to $0$ as $\,x\to \infty$) but in fact also compared to $\dfrac x{(\log x)^3}$ and so on because $\;\log((\log x)^n)=n\,\log \log x$ "can't beat" $\sqrt{c\;\log\,x}$ for very large $x$.
From $\;\displaystyle\pi(x)\sim \frac x{A\,\log(x)-B}\sim \frac x{A\,\log\,x}\;\frac{1}{\large{1-\frac B{A\,\log x}}}\sim \frac x{A\,\log\,x}+\frac {B\;x}{(A\,\log\,x)^2}\;$
we deduce that $\boxed{A=1}$ (the P.N.T.) and $\boxed{B=1}$ as wished.
We obtained in fact the more general (see Edwards p.$87$ for some consequences by Littlewood) : $$\tag{4}\pi(x)\sim \frac x{\log x}+\frac {1!\;x}{(\log x)^2}+\frac {2!\;x}{(\log x)^3}+\cdots+\frac {(n-1)!\;x}{(\log x)^n},\quad x\to \infty$$