OFFSET
0,3
COMMENTS
As positive palindromes do not end in 0 terms are not a multiple of 10. - David A. Corneth, Oct 07 2022
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..60 (terms 1..40 from David A. Corneth)
David A. Corneth, Lower bounds for a(0)..a(100)
FORMULA
EXAMPLE
a(8) = 252 as 252 is the largest palindrome that divides 8! = 40320.
MATHEMATICA
Table[SelectFirst[Reverse[Divisors[n!]], PalindromeQ], {n, 30}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 19 2020 *)
PROG
(PARI) a(n) = { res = 1; my(d = divisors(n! >> val(n, 2))); forstep(i = #d, 1, -1, if(ispal(d[i]), res = d[i]; break; ) ); d = divisors(n! / 5^val(n, 5)); forstep(i = #d, 1, -1, if(d[i] < res, return(res); ); if(ispal(d[i]), res = d[i]; break; ) ); res }
ispal(n) = my(d = digits(n)); d == Vecrev(d)
val(n, p) = my(r=0); while(n, r+=n\=p); r \\ David A. Corneth, Oct 07 2022
(Python)
from sympy import divisors, factorial, multiplicity
def ispal(n): s = str(n); return s == s[::-1]
def b(n, k): f = factorial(n); return f//k**multiplicity(k, f)
def a(n):
m2 = max(d for d in divisors(b(n, 2), generator=True) if ispal(d))
m5 = max(d for d in divisors(b(n, 5), generator=True) if ispal(d))
return max(m2, m5)
print([a(n) for n in range(34)]) # Michael S. Branicky, Oct 12 2022 after David A. Corneth
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Apr 23 2004
EXTENSIONS
More terms from Jason Earls, May 07 2004
a(0) and more terms from David A. Corneth, Oct 07 2022
STATUS
approved