A093888 Largest palindromic divisor of n!.
1, 1, 2, 6, 8, 8, 9, 252, 252, 252, 48384, 48384, 48384, 48384, 525525, 525525, 525525, 595595, 595595, 969969, 969969, 969969, 405909504, 5273993725, 5273993725, 5273993725, 5273993725, 5273993725, 5273993725, 5273993725, 5273993725, 290826628092, 290826628092, 290826628092
Offset: 0
Examples
a(8) = 252 as 252 is the largest palindrome that divides 8! = 40320.
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)
Programs
-
Mathematica
Table[SelectFirst[Reverse[Divisors[n!]],PalindromeQ],{n,30}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 19 2020 *)
-
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
Formula
Extensions
More terms from Jason Earls, May 07 2004
a(0) and more terms from David A. Corneth, Oct 07 2022
Comments