OFFSET
1,2
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..10000
FORMULA
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A118031 = 3.370283... . - Amiram Eldar, Jan 01 2024
EXAMPLE
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}.
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 *)
PROG
(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
(PARI) a(n) = sumdiv(n, d, my(dd=digits(d)); Vecrev(dd) == dd); \\ Michel Marcus, Apr 06 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Labos Elemer, Oct 08 2003
STATUS
approved