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”).
%I #18 Aug 30 2021 17:18:56
%S 1,2,3,4,5,6,7,8,9,0,11,212,313,414,515,616,717,818,919,0,121,22,323,
%T 424,525,626,727,828,929,0,131,232,33,434,535,636,737,838,939,0,141,
%U 242,343,44,545,646,747,848,949,0,151,252,353,454,55,656,757,858,959
%N Smallest palindrome ending with n or 0 if n is a multiple of 10.
%H Chai Wah Wu, <a href="/A347346/b347346.txt">Table of n, a(n) for n = 1..10000</a>
%F If n is not a multiple of 10, then a(n) = A082216(A004086(n)).
%o (Python)
%o def A347346(n):
%o if n % 10 == 0:
%o return 0
%o s = str(n)
%o if s == s[::-1]:
%o return n
%o for i in range(1,len(s)):
%o if s[:-i]== s[-i-1::-1]:
%o return int(s[:-i-1:-1]+s)
%Y Cf. A004086, A082216, A347347.
%K nonn,base,look
%O 1,2
%A _Chai Wah Wu_, Aug 27 2021