cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A093888 Largest palindromic divisor of n!.

Original entry on oeis.org

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

Views

Author

Amarnath Murthy, Apr 23 2004

Keywords

Comments

As positive palindromes do not end in 0 terms are not a multiple of 10. - David A. Corneth, Oct 07 2022

Examples

			a(8) = 252 as 252 is the largest palindrome that divides 8! = 40320.
		

Crossrefs

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

a(n) = A093030(A000142(n)). - Michel Marcus, Oct 12 2022

Extensions

More terms from Jason Earls, May 07 2004
a(0) and more terms from David A. Corneth, Oct 07 2022