login
Number of palindromes between n and 2n (inclusive).
2

%I #12 Oct 01 2021 10:25:27

%S 2,3,4,5,5,5,4,3,2,1,2,1,1,1,1,1,2,2,2,2,2,3,2,2,2,2,2,3,3,3,3,3,4,3,

%T 3,3,3,3,4,4,4,4,4,5,4,4,4,4,4,5,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,8,7,7,

%U 7,7,8,8,8,8,8,9,9,8,8,8,9,9,9,9,9,10,10,10,9,9,10,10,10,10,10,11,11,11,11

%N Number of palindromes between n and 2n (inclusive).

%H Michael S. Branicky, <a href="/A085763/b085763.txt">Table of n, a(n) for n = 1..10000</a>

%o (Python)

%o def ispal(s): return s == s[::-1]

%o def a(n): return sum(ispal(str(i)) for i in range(n, 2*n+1))

%o print([a(n) for n in range(1, 100)]) # _Michael S. Branicky_, Oct 01 2021

%Y Cf. A002113, A085764.

%K base,easy,nonn

%O 1,1

%A _Amarnath Murthy_ and _Jason Earls_, Jul 22 2003