A136522 a(n) = 1 if n is a palindrome, otherwise 0.
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0
Links
Programs
-
Haskell
a136522 n = fromEnum $ n == a004086 n -- Reinhard Zumkeller, Apr 08 2011
-
Mathematica
fQ[n_]:=Module[{id=IntegerDigits[n]}, Boole[id==Reverse[id]]]; Array[fQ, 100] (* Vladimir Joseph Stephan Orlovsky, Dec 29 2010 *) Table[If[PalindromeQ[n],1,0],{n,0,120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 23 2019 *)
-
Python
def A136522(n): return int((s:=str(n))[:(t:=(len(s)+1)//2)]==s[:-t-1:-1]) # Chai Wah Wu, Jun 23 2022
Formula
a(n) = if A004086(n) = n then 1 else 0. - Reinhard Zumkeller, Apr 08 2011
Comments