login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A061917
Either a palindrome or becomes a palindrome if trailing 0's are omitted.
17
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 22, 30, 33, 40, 44, 50, 55, 60, 66, 70, 77, 80, 88, 90, 99, 100, 101, 110, 111, 121, 131, 141, 151, 161, 171, 181, 191, 200, 202, 212, 220, 222, 232, 242, 252, 262, 272, 282, 292, 300, 303, 313, 323, 330, 333, 343, 353, 363, 373, 383, 393, 400, 404
OFFSET
1,3
COMMENTS
Numbers that are palindromes when written with a suitable number of leading zeros. - Jeppe Stig Nielsen, Jan 17 2022
LINKS
FORMULA
A136522(A004151(a(n))) = 1. - Reinhard Zumkeller, Sep 25 2011
MATHEMATICA
PaleQ[n_Integer, base_Integer] := Module[{idn, trim = n/base^IntegerExponent[n, base]}, idn = IntegerDigits[trim, base]; idn == Reverse[idn]]; Select[Range[0, 500], PaleQ[#, 10] &] (* Lei Zhou, Dec 13 2013 *)
Join[{0}, Select[Range[500], PalindromeQ[FromDigits[Drop[IntegerDigits[#], -IntegerExponent[#, 10]]]]&]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 27 2017 *)
PROG
(Haskell)
a061917 n = a061917_list !! (n-1)
a061917_list = filter chi [0..] where
chi x = zs == reverse zs where
zs = dropWhile (== '0') $ reverse $ show x
-- Reinhard Zumkeller, Sep 25 2011
(PARI) isOK(k)=k==0||fromdigits(Vecrev(digits(k)))==k/10^valuation(k, 10) \\ Jeppe Stig Nielsen, Jan 17 2022
(Python)
def ispal(s): return s == s[::-1]
def ok(n): s = str(n); return ispal(s) or ispal(s.rstrip('0'))
print([k for k in range(405) if ok(k)]) # Michael S. Branicky, Jan 17 2022
CROSSREFS
KEYWORD
nonn,base,easy,nice
AUTHOR
N. J. A. Sloane, Jun 27 2001
EXTENSIONS
Corrected by Ray Chandler, Jun 08 2009
STATUS
approved