login
A391768
Records k >= 3 such that log((k-1)!)/log(k) is closer to an integer than any m < k.
0
3, 4, 5, 25, 55, 136, 161, 193, 847, 1615, 5705, 10309, 13533, 81978, 121305, 190740, 209620, 887107, 932749, 1548856, 2638490, 4707168, 8819235, 50099883
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
Cf. A248868.
Sequence in context: A126896 A334225 A123957 * A370625 A085285 A282250
KEYWORD
nonn,more
AUTHOR
Tsuyoshi Hanatate, Mar 28 2026
EXTENSIONS
a(23)-a(24) from Sean A. Irvine, Apr 03 2026
STATUS
approved