cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A340835 a(n) is the least k such that the digit reversal of k is greater than or equal to n.

Original entry on oeis.org

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, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17
Offset: 0

Views

Author

Rémy Sigrist, Mar 13 2021

Keywords

Comments

A004086 gives the digit reversal of a number.
All positive terms belong to A070698.
This sequence is nondecreasing.

Examples

			For n = 1000:
- A004086(k) < 1000 for any k <= 1000,
- A004086(1001) = 1001 >= 1000,
- so a(1000) = 1001.
		

Crossrefs

Cf. A004086, A070698, A340836 (binary analog).

Programs

  • PARI
    { base = 10; k = 0; r = 0; for (n=0, 67, while (r
    				
  • Python
    def A340835(n):
        if n == 0:
            return 0
        s = str(n)
        for i, x in enumerate(s):
            if x != '9':
                break
        else:
            return n
        s1, s2 = s[:i+1], s[i+1:]
        if s2 == '':
            if s1[-1] == '0':
                return int(str(n+1)[::-1])
            else:
                return int(s[::-1])
        if int(s2) <= 1:
            return int('1'+s2[-2::-1]+s1[::-1])
        else:
            return int('1'+'0'*(len(s2)-1)+str(int(s1)+1)[::-1]) # Chai Wah Wu, Mar 14 2021

Formula

a(n) <= n + 1 with equality iff n = 10^k for some k > 0.
Showing 1-1 of 1 results.