OFFSET
0,4
COMMENTS
The best approximation can be smaller or larger than n!; that is, minimize abs(n!-r^s).
In the case of a tie, choose the smallest possible s (for example, when n=3, n!=6, we have 2^2 <= 6 <= 2^3 equally distant, choose 2^2).
LINKS
Sean A. Irvine, Java program (github)
EXAMPLE
a(4) = 3, since 3^3 - 3 = 24 = 4! (note 5^2-1 = 24 is not allowed because 2 < 5).
a(7) = 4, since 4^6 + 944 = 5040 = 7! and there is no closer approximation.
CROSSREFS
KEYWORD
nonn
AUTHOR
Sean A. Irvine, Mar 26 2021
STATUS
approved