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.

A282442 a(n) is the smallest step size that does not occur on a staircase of n steps when following the following procedure: Take steps of length 1 up a staircase until you can't step any further, then take steps of length 2 down until you can't step any further, and so on.

This page as a plain text file.
%I A282442 #28 Mar 29 2020 09:32:18
%S A282442 2,3,3,4,6,5,5,9,9,8,10,11,11,15,15,11,12,18,19,16,20,17,15,24,25,18,
%T A282442 20,28,19,24,26,21,21,31,31,20,28,25,21,32,40,33,31,39,39,25,25,35,35,
%U A282442 51,47,32,40,54,55,48,50,41,39,60,59,58,63,59,49,50,58
%N A282442 a(n) is the smallest step size that does not occur on a staircase of n steps when following the following procedure: Take steps of length 1 up a staircase until you can't step any further, then take steps of length 2 down until you can't step any further, and so on.
%C A282442 a(n) <= n + 1.
%C A282442 From the Mathematics Stack Exchange question:
%C A282442 Assume there are n stairs (so n+1 places to stand).
%C A282442 Starting from the bottom, go up 1 stair at a time, until you reach the top;
%C A282442 then turn around and go down 2 stairs at a time, until you can't go further;
%C A282442 then turn around and go up 3 stairs at a time, until you can't go further;
%C A282442 then 4, 5, 6, etc. stairs at a time, until you can't even make one step.
%H A282442 Peter Kagey, <a href="/A282442/b282442.txt">Table of n, a(n) for n = 1..10000</a>
%H A282442 Sheljohn, <a href="http://math.stackexchange.com/questions/2145924">A curious sequence</a>, Mathematics Stack Exchange, Feb 15 2017.
%e A282442 For n = 4:
%e A282442 step size 1: 0 -> 1 -> 2 -> 3 -> 4;
%e A282442 step size 2: 4 -> 2 -> 0;
%e A282442 step size 3: 0 -> 3.
%e A282442 Because the walker cannot take four steps down, a(4) = 4.
%p A282442 A282442 := proc(n)
%p A282442     local h,dir,ss,ns;
%p A282442     h := 0 ;
%p A282442     dir := 1 ;
%p A282442     for ss from 1 do
%p A282442         if dir > 0 then
%p A282442             ns := floor((n-h)/ss) ;
%p A282442         else
%p A282442             ns := floor(h/ss) ;
%p A282442         end if;
%p A282442         if ns = 0 then
%p A282442             return ss;
%p A282442         end if;
%p A282442         h := h+dir*ns*ss ;
%p A282442         dir := -dir ;
%p A282442     end do:
%p A282442 end proc:
%p A282442 seq(A282442(n),n=1..100) ; # _R. J. Mathar_, Feb 25 2017
%t A282442 a[n_] := Module[{h = 0, dir = 1, ss, ns}, For[ss = 1, True, ss++, If[dir > 0, ns = Floor[(n - h)/ss], ns = Floor[h/ss]]; If[ns == 0, Return[ss]]; h = h + dir ns ss; dir = -dir]];
%t A282442 Array[a, 100] (* _Jean-François Alcover_, Mar 29 2020, after _R. J. Mathar_ *)
%K A282442 nonn,look
%O A282442 1,1
%A A282442 _Peter Kagey_, Feb 15 2017