login
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
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, 20, 28, 19, 24, 26, 21, 21, 31, 31, 20, 28, 25, 21, 32, 40, 33, 31, 39, 39, 25, 25, 35, 35, 51, 47, 32, 40, 54, 55, 48, 50, 41, 39, 60, 59, 58, 63, 59, 49, 50, 58
OFFSET
1,1
COMMENTS
a(n) <= n + 1.
From the Mathematics Stack Exchange question:
Assume there are n stairs (so n+1 places to stand).
Starting from the bottom, go up 1 stair at a time, until you reach the top;
then turn around and go down 2 stairs at a time, until you can't go further;
then turn around and go up 3 stairs at a time, until you can't go further;
then 4, 5, 6, etc. stairs at a time, until you can't even make one step.
LINKS
Sheljohn, A curious sequence, Mathematics Stack Exchange, Feb 15 2017.
EXAMPLE
For n = 4:
step size 1: 0 -> 1 -> 2 -> 3 -> 4;
step size 2: 4 -> 2 -> 0;
step size 3: 0 -> 3.
Because the walker cannot take four steps down, a(4) = 4.
MAPLE
A282442 := proc(n)
local h, dir, ss, ns;
h := 0 ;
dir := 1 ;
for ss from 1 do
if dir > 0 then
ns := floor((n-h)/ss) ;
else
ns := floor(h/ss) ;
end if;
if ns = 0 then
return ss;
end if;
h := h+dir*ns*ss ;
dir := -dir ;
end do:
end proc:
seq(A282442(n), n=1..100) ; # R. J. Mathar, Feb 25 2017
MATHEMATICA
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]];
Array[a, 100] (* Jean-François Alcover, Mar 29 2020, after R. J. Mathar *)
CROSSREFS
Sequence in context: A003977 A003971 A349371 * A200668 A200469 A200251
KEYWORD
nonn,look
AUTHOR
Peter Kagey, Feb 15 2017
STATUS
approved