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

A285200 a(n) = floor the elevator is on at the n-th stage of Ken Knowlton's elevator problem, version 1.

Original entry on oeis.org

1, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1
Offset: 1

Views

Author

N. J. A. Sloane, May 02 2017

Keywords

Comments

An elevator steps up or down a floor at a time. It starts at floor 1, and always goes up from floor 1. From each floor m, it steps up every m-th time it stops there, otherwise down.
See A285202 for an alternative way to display this sequence.

References

  • Ken Knowlton, Email to R. L. Graham, Apr 26 2017

Crossrefs

See A286281 for a second version of the elevator problem.

Programs

  • Maple
    hit:=Array(1..50,0);
    hit[1]:=1; a:=[1]; dir:=1; f:=1;
    for s from 2 to 1000 do
    if dir>0 then f:=f+1; else f:=f-1; fi;
    hit[f]:=hit[f]+1; a:=[op(a),f];
    if (hit[f] mod f) = 0 then dir:=1; else dir:=-1; fi;
    od:
    a;

A285201 Stage at which Ken Knowlton's elevator (version 1) reaches floor n for the first time.

Original entry on oeis.org

1, 2, 5, 14, 45, 174, 825, 4738, 32137, 251338, 2224157, 21952358, 238962581, 2843085270, 36696680241, 510647009850, 7619901954001, 121367981060434, 2055085325869813, 36861997532438654, 698193329457246653, 13924819967953406654, 291683979376372766697, 6402385486361598687666, 146948520147021794869977
Offset: 1

Views

Author

R. L. Graham, May 02 2017

Keywords

Comments

Indices of records in A285200.
When prefixed by a(0)=0, the first differences give A111063. - N. J. A. Sloane, May 03 2017

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, n, ((n-1)^2*a(n-1)
          -(n-2)*(2*n-3)*a(n-2)+(n-1)*(n-3)*a(n-3))/(n-2))
        end:
    seq(a(n), n=1..25);  # Alois P. Heinz, Jul 11 2018
  • Mathematica
    a[n_] := 2 - n + 2 Sum[k!/j!, {k, 0, n-2}, {j, 0, k}];
    Array[a, 25] (* Jean-François Alcover, Nov 01 2020 *)

Formula

a(n) = 2 - n + 2 * Sum_{k=0..n-2} Sum_{j=0..k} k!/j!.
For n >= 2, a(n) = 1+n+2*Sum_{k=2..n} C(n,k)*(k-1)! = 1+n+2*n!*Sum_{k=2..n} 1/(k*(n-k)!). - N. J. A. Sloane, May 03 2017
E.g.f.: exp(x)*(1-x-2*log(1-x)). Omitting the factor exp(x), this gives (essentially) the e.g.f. for A098558 (or A052849). - N. J. A. Sloane, May 03 2017

A286282 Stage at which Ken Knowlton's elevator (version 2) reaches floor n for the first time.

Original entry on oeis.org

1, 2, 5, 18, 79, 408, 2469, 17314, 138555, 1247052, 12470593, 137176614, 1646119479, 21399553360, 299593747197, 4493906208138, 71902499330419, 1222342488617364, 22002164795112825, 418041131107143982, 8360822622142879983, 175577275065000480024, 3862700051430010560949
Offset: 1

Views

Author

N. J. A. Sloane, May 09 2017

Keywords

Comments

Indices of records in A286281.
Theorem: Let b(n) = Sum_{k=0..n} n!/k! = A000522(n). Then a(n) = 2*b(n-1)-n+2-2*(n-1)!. - R. L. Graham, May 10 2017
This implies the following recurrence (conjectured by N. J. A. Sloane on May 09 2017): a(1)=1, and for n>=1, a(n+1) = n*a(n) + n^2 - 3*n + 3. From the asymptotic expansion of b(n) (see A000522), we have a(n) ~ 2*(e-1)*(n-1)!.

Crossrefs

Programs

  • Maple
    A286282 := proc(n)
        2*A002627(n-1)-n+2 ;
    end proc:
    seq(A286282(n),n=1..21) ; # R. J. Mathar, May 21 2017
  • Mathematica
    f[n_, m_: 20] := Block[{a = {}, r = ConstantArray[0, m], f = 1, d = 0}, Do[AppendTo[a, f]; If[d == 1, r = MapAt[# + 1 &, r, f]]; If[Or[And[ Divisible[r[[f]], f], d == 1], f == 1], f++; d = 1, f--; d = -1], {i, n}]; a]; Rest@ Map[First, Values@ PositionIndex@ FoldList[Max, 0, f@ 200000]] - 1 (* Michael De Vlieger, May 10 2017, Version 10 *)
  • Python
    times = {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1}
    first = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0}
    floor = 1
    steps = 1
    while floor < 17:
        if first[floor] == 0:
            first[floor] = 1
            print("First Time: ",floor,steps)
        if floor == 1:
            floor += 1
        else:
            if times[floor] < floor:
                times[floor] += 1
                floor -= 1
            else:
                times[floor] = 0
                floor += 1
        steps += 1
    print(floor, steps)
    # David Consiglio, Jr., May 09 2017

Formula

a(n) = 2*A002627(n-1) - (n-2). - N. J. A. Sloane, May 15 2017
Conjecture: a(n) +(-n-2)*a(n-1) +3*(n-1)*a(n-2) +(-3*n+8)*a(n-3) +(n-4)*a(n-4)=0. - R. J. Mathar, May 21 2017
Conjecture: (n+1)*a(n) +(-n^2+3*n-27)*a(n-1) +3*(-n^2+10*n-13)*a(n-2) +(n-3)*(4*n-17)*a(n-3)=0. - R. J. Mathar, May 21 2017

Extensions

a(10)-a(13) from David Consiglio, Jr., May 09 2017
Further terms added by N. J. A. Sloane, May 10 2017 based on R. L. Graham's formula.
Showing 1-3 of 3 results.