%I #36 Mar 14 2021 14:26:15
%S 0,1,2,3,4,5,6,7,8,9,11,11,12,12,12,12,12,12,12,12,12,12,13,13,13,13,
%T 13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,
%U 15,15,15,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17
%N a(n) is the least k such that the digit reversal of k is greater than or equal to n.
%C A004086 gives the digit reversal of a number.
%C All positive terms belong to A070698.
%C This sequence is nondecreasing.
%H Rémy Sigrist, <a href="/A340835/b340835.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) <= n + 1 with equality iff n = 10^k for some k > 0.
%e For n = 1000:
%e - A004086(k) < 1000 for any k <= 1000,
%e - A004086(1001) = 1001 >= 1000,
%e - so a(1000) = 1001.
%o (PARI) { base = 10; k = 0; r = 0; for (n=0, 67, while (r<n, r = fromdigits(Vecrev(digits(k++, base)), base);); print1 (k ", ")) }
%o (Python)
%o def A340835(n):
%o if n == 0:
%o return 0
%o s = str(n)
%o for i, x in enumerate(s):
%o if x != '9':
%o break
%o else:
%o return n
%o s1, s2 = s[:i+1], s[i+1:]
%o if s2 == '':
%o if s1[-1] == '0':
%o return int(str(n+1)[::-1])
%o else:
%o return int(s[::-1])
%o if int(s2) <= 1:
%o return int('1'+s2[-2::-1]+s1[::-1])
%o else:
%o return int('1'+'0'*(len(s2)-1)+str(int(s1)+1)[::-1]) # _Chai Wah Wu_, Mar 14 2021
%Y Cf. A004086, A070698, A340836 (binary analog).
%K nonn,base
%O 0,3
%A _Rémy Sigrist_, Mar 13 2021