A087990 Number of palindromic divisors of n.
1, 2, 2, 3, 2, 4, 2, 4, 3, 3, 2, 5, 1, 3, 3, 4, 1, 5, 1, 4, 3, 4, 1, 6, 2, 2, 3, 4, 1, 5, 1, 4, 4, 2, 3, 6, 1, 2, 2, 5, 1, 5, 1, 6, 4, 2, 1, 6, 2, 3, 2, 3, 1, 5, 4, 5, 2, 2, 1, 6, 1, 2, 4, 4, 2, 8, 1, 3, 2, 4, 1, 7, 1, 2, 3, 3, 4, 4, 1, 5, 3, 2, 1, 6, 2, 2, 2, 8, 1, 6, 2, 3, 2, 2, 2, 6, 1, 3, 6, 4, 2, 4, 1, 4, 4
Offset: 1
Examples
n=132: divisors={1, 2, 3, 4, 6, 11, 12, 22, 33, 44, 66, 132}, revdivisors={1, 2, 3, 4, 6, 11, 21, 22, 33, 44, 66, 231}, a[132]=10; so 10 of 12 divisors of n are palindromic: {1, 2, 3, 4, 6, 11, 22, 33, 44, 66}.
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
nd[x_, y_] := 10*x+y; tn[x_] := Fold[nd, 0, x]; rdi[x_] := tn[Reverse[IntegerDigits[x]]]; d0[x_] := DivisorSigma[0, x]; di[x_, i_] := Part[Divisors[x], i]; Table[Count[Divisors[s]-Table[rdi[di[s, w]], {w, 1, d0[s]}], 0], {s, 1, 256}] palQ[n_] := Reverse[x = IntegerDigits[n]] == x; Table[Count[Divisors[n], ?(palQ[#] &)], {n, 105}] (* _Jayanta Basu, Aug 10 2013 *) Table[Count[Divisors[n],?PalindromeQ],{n,110}] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale, Jun 28 2017 *)
-
PARI
a(n) = sumdiv(n, d, my(dd=digits(d)); Vecrev(dd) == dd); \\ Michel Marcus, Apr 06 2020
-
Python
def ispal(n): t = str(n) return t == t[::-1] def A087990(n): s=0 for i in range(1,n+1): if n%i==0 and ispal(i): s+=1 return s # Indranil Ghosh, Feb 10 2017
Formula
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A118031 = 3.370283... . - Amiram Eldar, Jan 01 2024