Daily Mathematics / Solutions
Solutions for 18 October 2026
Two cards went out that day: a hard definite integral and an original Putnam-style problem. Try each one first; the solutions are folded away below.
Integral
The sine of a logarithm against a cyclotomic weight

Evaluate in closed form.
\[\int_{0}^{\infty}\frac{\sin(\ln x)}{\ln x}\,\frac{dx}{x^{2}+x+1}\]Show the solution
Call the integral \(I\). The integrand is continuous on \((0,\infty)\) (its value at \(x=1\) is \(1\)), bounded by \(1/(x^{2}+x+1)\), so \(I\) converges absolutely. There is no elementary antiderivative, and the symmetry \(x\mapsto 1/x\) (which leaves both factors and \(dx/(x^{2}+x+1)\) unchanged) only folds the range onto \((0,1)\) without removing the \(1/\ln x\). The way in is to remove that denominator with a parameter.
Step 1: a parameter integral. For every \(x>0\), \(\dfrac{\sin(\ln x)}{\ln x}=\displaystyle\int_{0}^{1}\cos(t\ln x)\,dt\) (at \(x=1\) both sides equal \(1\)). The double integrand is bounded by \(1/(x^{2}+x+1)\), which is integrable on \((0,\infty)\times[0,1]\), so Fubini gives
\[I=\int_{0}^{1}C(t)\,dt,\qquad C(t)=\int_{0}^{\infty}\frac{\cos(t\ln x)}{x^{2}+x+1}\,dx .\]Step 2: a Mellin transform at a complex exponent. Put \(M(s)=\displaystyle\int_{0}^{\infty}\frac{x^{s-1}}{x^{2}+x+1}\,dx\), which converges and is analytic for \(0<\operatorname{Re}s<2\). Since \(x^{it}=\cos(t\ln x)+i\sin(t\ln x)\) and \(\int_{0}^{\infty}\sin(t\ln x)\,dx/(x^{2}+x+1)=0\) (the substitution \(x\mapsto 1/x\) changes its sign), we get \(C(t)=M(1+it)\).
Step 3: evaluating \(M\). Let \(\alpha=e^{i\pi/3}\), so \(x^{2}+x+1=(x+\alpha)(x+\bar\alpha)\) and \(\bar\alpha-\alpha=-i\sqrt3\). For real \(0<s<1\) and \(|\arg c|<\pi\) we have \(\int_{0}^{\infty}\frac{x^{s-1}}{x+c}\,dx=\frac{\pi\,c^{s-1}}{\sin\pi s}\) (principal power): for \(c>0\) this is the Beta integral \(B(s,1-s)\) after \(x=cy\), and both sides are analytic in \(c\) on the slit plane. Partial fractions then give
\[M(s)=\frac{1}{\bar\alpha-\alpha}\cdot\frac{\pi\,(\alpha^{s-1}-\bar\alpha^{s-1})}{\sin\pi s}=\frac{\pi\,\sin\!\bigl(\pi(1-s)/3\bigr)}{\sin(\pi/3)\,\sin\pi s}.\]The right side is analytic on \(0<\operatorname{Re}s<2\) (the zero of \(\sin\pi s\) at \(s=1\) is cancelled by the numerator), so by the identity theorem the formula holds on the whole strip. At \(s=1+it\) we have \(\sin(-i\pi t/3)=-i\sinh(\pi t/3)\) and \(\sin(\pi+i\pi t)=-i\sinh\pi t\), hence
\[C(t)=\frac{2\pi}{\sqrt3}\,\frac{\sinh(\pi t/3)}{\sinh\pi t}\qquad(t\ne0),\]with the limiting value \(2\pi/(3\sqrt3)=\int_{0}^{\infty}dx/(x^{2}+x+1)\) at \(t=0\), as it must be.
Step 4: the \(t\)-integral. With \(a=\pi t/3\) and \(\sinh 3a=\sinh a\,(4\cosh^{2}a-1)=\sinh a\,(1+2\cosh 2a)\),
\[I=\frac{2\pi}{\sqrt3}\cdot\frac{3}{\pi}\int_{0}^{\pi/3}\frac{da}{1+2\cosh 2a}=2\sqrt3\int_{0}^{\pi/3}\frac{da}{1+2\cosh 2a}.\]Now \(u=\tanh a\) gives \(\cosh 2a=\frac{1+u^{2}}{1-u^{2}}\) and \(da=\frac{du}{1-u^{2}}\), so the integrand becomes \(\frac{du}{(1-u^{2})+2(1+u^{2})}=\frac{du}{3+u^{2}}\). Therefore
\[I=2\sqrt3\cdot\frac{1}{\sqrt3}\arctan\frac{\tanh(\pi/3)}{\sqrt3}=2\arctan\!\left(\frac{\tanh(\pi/3)}{\sqrt3}\right)\approx 0.8469477380 .\]Check. The equivalent form \(I=2\int_{0}^{\infty}\frac{\sin u}{u\,(1+2\cosh u)}\,du\) (put \(x=e^{u}\)) was integrated by composite 100-node Gauss–Legendre quadrature on \([0,60]\) with 40 and with 200 panels, and the original integral was also computed directly on both halves \((0,1)\) and \((1,\infty)\); all three agree with the closed form to about \(10^{-16}\).
Competition problem
Functions whose second iterate never moves backwards

Let \(n\) be a positive integer. Prove that the number of functions \(f:\{1,\dots,n\}\to\{1,\dots,n\}\) such that
\[f(f(k))\ge k\qquad(1\le k\le n)\]equals the number of ways \(n\) runners can finish a race when ties are allowed.
Show the solution
For a finite totally ordered set \(X\), call \(g:X\to X\) good if \(g(g(x))\ge x\) for all \(x\in X\). The number of good maps depends only on \(|X|\); call it \(a_{m}\) for \(|X|=m\), with \(a_{0}=1\). Let \(b_{m}\) be the number of finishing orders of \(m\) runners with ties allowed (ordered set partitions), \(b_{0}=1\). We show \(a_{n}=b_{n}\) by proving that both satisfy the same recurrence.
Why the obvious routes stall. Peeling off the largest element \(n\) forces \(f(f(n))=n\), but the constraints on the remaining elements then depend on the value \(f(n)\). Sorting the maps by the size of their image does not match the number of finishing orders with a given number of distinct places either (for \(n=3\) there are 4 good maps with image size 3, not \(3!=6\)). The element that behaves rigidly is the smallest one.
Step 1: the recurrence for \(b\). Choose the set of first-place finishers, of size \(j\ge1\), and then a finishing order of the other \(n-j\) runners. Hence \(b_{n}=\sum_{j=1}^{n}\binom{n}{j}b_{n-j}=\sum_{r=0}^{n-1}\binom{n}{r}b_{r}\).
Step 2: two facts about the element 1. Let \(f\) be good on \([n]=\{1,\dots,n\}\), let \(C=f^{-1}(1)\) and \(b=f(1)\).
(i) If \(k\ge2\) then \(f(k)\notin C\), since otherwise \(f(f(k))=1<k\).
(ii) For \(c\in C\) the condition at \(c\) reads \(f(f(c))=f(1)=b\ge c\); so \(b\ge\max C\) when \(C\ne\varnothing\). The condition at \(1\) itself, \(f(f(1))\ge1\), is automatic.
Step 3: the case analysis. For \(R\subseteq\{2,\dots,n\}\) write \(C_{R}=\{2,\dots,n\}\setminus R\).
Case 1: \(f(1)=1\). Then \(1\in C\) and (ii) gives \(\max C\le1\), so \(C=\{1\}\). By (i) and \(C=\{1\}\), \(f\) maps \(\{2,\dots,n\}\) into itself, and it is good there. Conversely every good map on \(\{2,\dots,n\}\) extended by \(f(1)=1\) is good. Count: \(a_{n-1}\).
Case 2: \(C=\varnothing\). Nothing is sent to \(1\), so \(f\) maps \(\{2,\dots,n\}\) into itself and is good there, while \(f(1)=b\in\{2,\dots,n\}\) is arbitrary (the condition at \(1\) is automatic and no condition involves \(f(1)\) otherwise, because no \(k\ge2\) has \(f(k)=1\)). Count: \((n-1)a_{n-1}\).
Case 3: \(C\ne\varnothing\) and \(1\notin C\). Then \(C\subseteq\{2,\dots,n\}\); put \(R=\{2,\dots,n\}\setminus C\), a proper subset, so \(C=C_{R}\). For \(k\in R\), \(f(k)\ne1\) and \(f(k)\notin C\) by (i), so \(f(R)\subseteq R\) and \(g=f|_{R}\) is good. Also \(f\equiv1\) on \(C_{R}\), and \(b\ge\max C_{R}\ge2\) by (ii).
(3a) \(b\in C_{R}\). Then \(b=\max C_{R}\). Conversely, for any proper \(R\) and good \(g\) on \(R\), the map \(f=g\) on \(R\), \(f=1\) on \(C_{R}\), \(f(1)=\max C_{R}\) is good: on \(R\) by assumption; at \(1\), \(f(f(1))=1\ge1\); at \(k\in C_{R}\), \(f(f(k))=f(1)=\max C_{R}\ge k\). Contribution: \(\sum_{R\subsetneq\{2,\dots,n\}}a_{|R|}\).
(3b) \(b\in R\). Then \(b>\max C_{R}\), which says exactly that \(\{b,b+1,\dots,n\}\subseteq R\). Conversely any proper \(R\), good \(g\) on \(R\) and such \(b\) give a good \(f\): at \(1\), \(f(f(1))=g(b)\ge1\); at \(k\in C_{R}\), \(f(f(k))=b>\max C_{R}\ge k\). Contribution: \(\sum_{R}t(R)\,a_{|R|}\), where \(t(R)=\#\{b\in\{2,\dots,n\}:\{b,\dots,n\}\subseteq R\}\).
The cases are disjoint and exhaustive, and \(f\) determines \((R,g,b)\). For the full set \(R=\{2,\dots,n\}\) we have \(t(R)=n-1\), so Cases 1 and 2 together contribute \((1+t(R))a_{|R|}\) for that \(R\), and in all
\[a_{n}=\sum_{R\subseteq\{2,\dots,n\}}\bigl(1+t(R)\bigr)\,a_{|R|}.\]Step 4: collecting by size. Fix \(|R|=r\) with \(0\le r\le n-1\). There are \(\binom{n-1}{r}\) such \(R\). The sum of \(t(R)\) over them counts pairs \((R,b)\) with \(\{b,\dots,n\}\subseteq R\); writing \(j=n-b+1\in\{1,\dots,r\}\), the other \(r-j\) elements of \(R\) come from the \(n-1-j\) elements of \(\{2,\dots,b-1\}\), so
\[\sum_{|R|=r}t(R)=\sum_{j=1}^{r}\binom{n-1-j}{r-j}=\sum_{i=0}^{r-1}\binom{n-1-r+i}{i}=\binom{n-1}{r-1}\]by the hockey-stick identity \(\sum_{i=0}^{m}\binom{s+i}{i}=\binom{s+m+1}{m}\) (the sum is empty, hence \(0\), when \(r=0\)). The total weight of size \(r\) is therefore \(\binom{n-1}{r}+\binom{n-1}{r-1}=\binom{n}{r}\), and
\[a_{n}=\sum_{r=0}^{n-1}\binom{n}{r}a_{r}.\]Conclusion. Since \(a_{0}=b_{0}=1\) and \(a\), \(b\) satisfy the same recurrence, strong induction gives \(a_{n}=b_{n}\) for all \(n\): the number of good functions equals the number of finishing orders with ties, the ordered Bell numbers \(1,3,13,75,541,\dots\)
Check. All \(n^{n}\) functions were enumerated by computer for \(n\le7\); the counts \(1,3,13,75,541,4683,47293\) agree with the ordered Bell numbers computed from the recurrence of Step 1.