OFFSET
1,1
COMMENTS
Let x(k) = log((k-1)!)/log(k) and d(k) = dist(x(k), Z), where dist(x,Z) is the distance from x to the nearest integer. This sequence lists the record values of k >= 3 for which d(k) is smaller than all previous positive values. Equivalently, these are the values of k for which (k-1)! is closer than ever before to an integral power k^m on a logarithmic scale. Thus the sequence records best-so-far approximations of (k-1)! by powers k^m on a logarithmic scale. The case k = 2 is excluded because d(2) = 0. Using Stirling's formula, x(k) = k - k/log(k) - 1/2 + log(2*Pi)/(2*log(k)) + O(1/(k*log(k))).
FORMULA
x(k) = log((k-1)!)/log(k). d(k) = min_{m in Z} |x(k)-m|. a(1) = 3. For n > 1, a(n) = min { k > a(n-1) : d(k) < d(a(n-1)) }.
EXAMPLE
For k = 5, x(5) = log(24)/log(5) = 1.9746358687..., so d(5) = 0.0253641312....
This is smaller than d(3) = 0.3690702464... and d(4) = 0.2924812504..., so 5 is the third term.
MATHEMATICA
d[k_] := Module[{x, f},
x = N[LogGamma[k]/Log[k], 50];
f = FractionalPart[x];
Min[f, 1 - f]
]
a[limit_] := Module[{best = 1, out = {}, dk},
Do[
dk = d[k];
If[dk > 0 && dk < best,
AppendTo[out, k];
best = dk;
],
{k, 3, limit}
];
out
]
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Tsuyoshi Hanatate, Mar 28 2026
EXTENSIONS
a(23)-a(24) from Sean A. Irvine, Apr 03 2026
STATUS
approved
