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.
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
Examples
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.
Links
- Peter Kagey, Table of n, a(n) for n = 1..10000
- Sheljohn, A curious sequence, Mathematics Stack Exchange, Feb 15 2017.
Programs
-
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 *)
Comments