login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A137180 Number of palindromes in the range [1,n] inclusive. 2

%I

%S 0,1,2,3,4,5,6,7,8,9,9,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,

%T 11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,

%U 13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15

%N Number of palindromes in the range [1,n] inclusive.

%C A136687 - 1.

%D Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 71.

%t nthPalindrome[n_] := Block[{q = n + 1 - 10^Floor[ Log10[n + 1 - 10^Floor[ Log10[ n/10]] ]], c = Sum[ Floor[ Floor[ n/(11*10^(k - 1) - 1)]/(Floor[ n/(11*10^(k - 1) - 1)] - 1/10)] - Floor[ Floor[ n/(2*10^k - 1)]/(Floor[ n/(2*10^k - 1)] - 1/10)], {k, Floor[ Log10[ n]] }]}, Mod[q, 10]*11^c*10^Floor[ Log10[ q]] + Sum[ Floor[ Mod[q, 10^(k + 1)]/10^k]*10^(Floor[ Log10[ q]] - k) (10^(2 k + c) + 1) , {k, Floor[ Log10[ q]] }]];

%t palindromicPi[n_] := Block[{q = Floor[ n*10^-Floor[ Log10[ 10 n]/2]]}, r = q + 10^(Floor[ Log10[ q]] + Mod[ Floor[ Log10[ n]], 2]) - 1; r + Floor[ Tanh[n - nthPalindrome[ r]] ]]; (* after the work of Eric A. Schmidt, see A002113 *)

%t f[n_] := If[n < 1, 0, palindromicPi@ n]; Array[f, 75, 0] (* _Robert G. Wilson v_, Sep 22 2014 *)

%Y Cf. A002113, A136522, A136687.

%K nonn,base

%O 0,3

%A _N. J. A. Sloane_, Apr 21 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 18:12 EDT 2019. Contains 322461 sequences. (Running on oeis4.)