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-2 of 2 results.

A033075 Positive numbers all of whose pairs of consecutive decimal digits differ by 1.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 101, 121, 123, 210, 212, 232, 234, 321, 323, 343, 345, 432, 434, 454, 456, 543, 545, 565, 567, 654, 656, 676, 678, 765, 767, 787, 789, 876
Offset: 1

Views

Author

Keywords

Comments

Number of n-digit terms: 9, 17, 32, 61, 116, 222, 424 (= A090994).
Also called 10-esthetic numbers (where in general a q-esthetic number has the property that the consecutive digits of its base-q representation differ by 1, see "Esthetic numbers" by J. M. De Koninck and N. Doyon). - Narad Rampersad, Aug 03 2018

Crossrefs

Cf. A090994, A048398 (primes), A048411 (squares), A207954 (palindromes).

Programs

  • Haskell
    -- import Data.Set (fromList, deleteFindMin, insert)
    a033075 n = a033075_list !! (n-1)
    a033075_list = f (fromList [1..9]) where
       f s | d == 0    = m : f (insert (10*m+1) s')
           | d == 9    = m : f (insert (10*m+8) s')
           | otherwise = m : f (insert (10*m+d-1) (insert (10*m+d+1) s'))
           where (m,s') = deleteFindMin s
                 d = mod m 10
    -- Reinhard Zumkeller, Feb 21 2012
    
  • Mathematica
    Join[Range[9],Select[Range[2000],Union[Abs[Differences[IntegerDigits[#]]]]=={1}&]] (* Harvey P. Dale, Dec 28 2011 *)
  • PARI
    diff(v)=vector(#v-1,i,v[i+1]-v[i])
    is(n)=if(n>9, Set(abs(diff(digits(n))))==[1], n>0) \\ Charles R Greathouse IV, Mar 11 2014
    
  • Python
    def ok(n):
        s = str(n)
        return all(abs(int(s[i]) - int(s[i+1])) == 1 for i in range(len(s)-1))
    print(list(filter(ok, range(1, 877)))) # Michael S. Branicky, Aug 22 2021
    
  • Python
    # faster version for initial segment of sequence
    def gen(d, s=None): # generate remaining d digits, from start digit s
        if d == 0:
            yield tuple()
            return
        if s == None:
            yield from [(i, ) + g for i in range(1, 10) for g in gen(d-1, s=i)]
        else:
            if s > 0:
                yield from [(s-1, ) + g for g in gen(d-1, s=s-1)]
            if s < 9:
                yield from [(s+1, ) + g for g in gen(d-1, s=s+1)]
    def agentod(digits):
        for d in range(1, digits+1):
            yield from [int("".join(map(str, g))) for g in gen(d, s=None)]
    print(list(agentod(11))) # Michael S. Branicky, Aug 22 2021

Formula

a(n) >> n^3.53267..., where the exponent is log 10/log k and k is the largest root of x^5 - x^4 - 4x^3 + 3x^2 + 3x - 1. - Charles R Greathouse IV, Mar 11 2014

A048412 a(n)^2 is a square whose consecutive digits differ by 1.

Original entry on oeis.org

0, 1, 2, 3, 11, 26, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111
Offset: 1

Views

Author

Patrick De Geest, Apr 15 1999

Keywords

Comments

a(14), if it exists, is > 10^17. - Lars Blomberg, Nov 25 2016
a(14), if it exists, is > 10^26. - Michael S. Branicky, Apr 22 2025

Crossrefs

Formula

a(n) = sqrt(A048411(n)).

Extensions

Offset changed to 1 by Jinyuan Wang, Sep 04 2021
Showing 1-2 of 2 results.