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.
%I A286281 #19 May 10 2017 14:30:22 %S A286281 1,2,1,2,3,2,1,2,1,2,3,2,1,2,1,2,3,4,3,2,1,2,1,2,3,2,1,2,1,2,3,2,1,2, %T A286281 1,2,3,4,3,2,1,2,1,2,3,2,1,2,1,2,3,2,1,2,1,2,3,4,3,2,1,2,1,2,3,2,1,2, %U A286281 1,2,3,2,1,2,1,2,3,4,5,4,3,2,1,2,1,2,3,2,1,2,1,2,3,2,1,2,1,2,3,4 %N A286281 a(n) = floor the elevator is on at the n-th stage of Ken Knowlton's elevator problem, version 2. %C A286281 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 (except that stops when the elevator is going down don't count), otherwise down. %D A286281 Ken Knowlton, Email to R. L. Graham and N. J. A. Sloane, May 04 2017 %H A286281 N. J. A. Sloane, <a href="/A286281/b286281.txt">Table of n, a(n) for n = 1..20000</a> %H A286281 Ken Knowlton, <a href="/A286281/a286281.pdf">Illustration of initial terms showing floors the two versions of the elevator are on. Top: version 1 (A285200), bottom: version 2 (A286281) </a> %p A286281 hit:=Array(1..50, 0); %p A286281 hit[1]:=1; a:=[1]; dir:=1; f:=1; %p A286281 for s from 2 to 1000 do %p A286281 if dir>0 or f=1 then f:=f+1; hit[f]:=hit[f]+1; dir:=1; else f:=f-1; dir:=-1; fi; %p A286281 a:=[op(a), f]; %p A286281 if (dir=1) and ((hit[f] mod f) = 0) then dir:=1; else dir:=-1; fi; %p A286281 od: %p A286281 a; %t A286281 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]; f@ 100 (* _Michael De Vlieger_, May 10 2017 *) %Y A286281 For records see A286282. %Y A286281 See A285200 for the first version of the elevator problem. %K A286281 nonn %O A286281 1,2 %A A286281 _N. J. A. Sloane_, May 09 2017