login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 8

%I #28 Mar 29 2020 09:32:18

%S 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 20,28,19,24,26,21,21,31,31,20,28,25,21,32,40,33,31,39,39,25,25,35,35,

%U 51,47,32,40,54,55,48,50,41,39,60,59,58,63,59,49,50,58

%N 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 a(n) <= n + 1.

%C From the Mathematics Stack Exchange question:

%C Assume there are n stairs (so n+1 places to stand).

%C Starting from the bottom, go up 1 stair at a time, until you reach the top;

%C then turn around and go down 2 stairs at a time, until you can't go further;

%C then turn around and go up 3 stairs at a time, until you can't go further;

%C then 4, 5, 6, etc. stairs at a time, until you can't even make one step.

%H Peter Kagey, <a href="/A282442/b282442.txt">Table of n, a(n) for n = 1..10000</a>

%H Sheljohn, <a href="http://math.stackexchange.com/questions/2145924">A curious sequence</a>, Mathematics Stack Exchange, Feb 15 2017.

%e For n = 4:

%e step size 1: 0 -> 1 -> 2 -> 3 -> 4;

%e step size 2: 4 -> 2 -> 0;

%e step size 3: 0 -> 3.

%e Because the walker cannot take four steps down, a(4) = 4.

%p A282442 := proc(n)

%p local h,dir,ss,ns;

%p h := 0 ;

%p dir := 1 ;

%p for ss from 1 do

%p if dir > 0 then

%p ns := floor((n-h)/ss) ;

%p else

%p ns := floor(h/ss) ;

%p end if;

%p if ns = 0 then

%p return ss;

%p end if;

%p h := h+dir*ns*ss ;

%p dir := -dir ;

%p end do:

%p end proc:

%p seq(A282442(n),n=1..100) ; # _R. J. Mathar_, Feb 25 2017

%t 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 Array[a, 100] (* _Jean-François Alcover_, Mar 29 2020, after _R. J. Mathar_ *)

%K nonn,look

%O 1,1

%A _Peter Kagey_, Feb 15 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 13 09:21 EDT 2024. Contains 375904 sequences. (Running on oeis4.)