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.

User: Gerry Leversha

Gerry Leversha's wiki page.

Gerry Leversha has authored 2 sequences.

A235163 Number of positive integers with n digits in which adjacent digits differ by at most 1.

Original entry on oeis.org

9, 26, 75, 217, 629, 1826, 5307, 15438, 44941, 130900, 381444, 1111926, 3242224, 9455987, 27583372, 80472698, 234799873, 685149328, 1999414181, 5835044495, 17029601028, 49702671494, 145066398937, 423412132499, 1235854038791, 3607255734629, 10529101874491
Offset: 1

Author

Gerry Leversha, Jan 04 2014

Keywords

Examples

			a(2) = 26: 10, 11, 12, 21, 22, 23, 32, 33, 34, 43, 44, 45, 54, 55, 56, 65, 66, 67, 76, 77, 78, 87, 88, 89, 98, 99.
		

Crossrefs

Cf. A032981, A090994, A126364 (allowing leading zeros).

Programs

  • Maple
    u:= proc(n, r) option remember; `if`(n=1, `if`(r=0, 0, 1),
          add(`if`(r+i in [$0..9], u(n-1, r+i), 0), i=-1..1))
        end:
    a:= n-> add(u(n, r), r = 0..9):
    seq(a(n), n=1..30);  # Alois P. Heinz, Jan 12 2014
  • Mathematica
    CoefficientList[Series[-x*(3*x^4-18*x^3-9*x^2+28*x-9)/(x^5-6*x^4-x^3+10*x^2-6*x+1),{x,0,30}],x]//Rest (* Harvey P. Dale, Aug 13 2019 *)
  • Python
    from functools import cache
    @cache
    def u(n, r):
        if r < 0 or r > 9: return 0
        if n == 1: return (r > 0)
        return u(n-1, r-1) + u(n-1, r) + u(n-1, r+1)
    def a(n): return sum(u(n, r) for r in range(10))
    print([a(n) for n in range(1, 28)]) # Michael S. Branicky, Sep 26 2021

Formula

a(n) = Sum_{r=0..9} u(n,r) where u(n,r) = 0 if r<0 or r>9, u(1,0) = 0, u(1,r) = 1 for 1<=r<=9, and otherwise u(n,r) = u(n-1,r-1) + u(n-1,r) + u(n-1,r+1).
G.f.: -x*(3*x^4-18*x^3-9*x^2+28*x-9)/(x^5-6*x^4-x^3+10*x^2-6*x+1). - Alois P. Heinz, Jan 12 2014

A126933 Quotients arising from sequence A053312.

Original entry on oeis.org

1, 3, 14, 132, 691, 1908, 16579, 47352, 414301, 1183713, 5474669, 27151397, 135646011, 678174568, 6442602909, 18480090517, 85533990571, 424236721848, 4026815626549, 11550150977337, 53458791308981, 265147974756053, 1324666882885839, 6622797918981982, 62916043734881616, 329481245744393933
Offset: 1

Author

Gerry Leversha, Mar 18 2007

Keywords

Comments

Take the decimal number formed by the first n digits of A023396 in reverse order and divide by 2^n.
The sequence A053312 gives n-digit numbers consisting entirely of 1s and 2s which are divisible by 2^n. The quotients upon division form the present sequence. The parity of the n-th term here determines the next term in A023396; if odd, it is a 1 and if even, a 2.
This was set as a problem in the All Union Mathematical Olympiad of 1971 and can be found in the reference cited here.

Examples

			a(4) = A053312(4) / 2^4 = 2112 / 16 = 132. - _David A. Corneth_, Jun 11 2020
		

References

  • J. B. Tabov and P. J. Taylor, Methods of Problem Solving, Book 1, Australian Mathematics Trust, 1996.

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A126933_gen(): # generator of terms
        a, b = 2, 10
        for n in count(1):
            a+=b if (c:=a>>n)&1 else b<<1
            b *= 10
            yield c
    A126933_list = list(islice(A126933_gen(),20)) # Chai Wah Wu, Mar 16 2023

Formula

a(n) < 0.3 * 5^n. - David A. Corneth, Jun 11 2020

Extensions

Name changed and other minor edits by Ray Chandler, Jun 17 2020