OFFSET
0,3
COMMENTS
The minimum number of turns that always suffice to open from any starting position a bicycle lock that has n-1 dials with 5 numbers on each dial.
The minimum number of turns that always suffice to open from any starting position a bicycle lock that has 4 dials with n numbers on each dial.
(A "turn" consists of simultaneously rotating any number of adjacent dials by one place.)
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Robin Houston, Symmetry of bicycle lock numbers.
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,1,-1).
FORMULA
a(n) = max( min{x*y, (5-x)*(n-y)} | 0 <= x <= 5, 0 <= y <= n ).
From Ralf Stephan, Mar 29 2014: (Start)
a(n) = n + floor(n/5) - [n == 1 mod 5].
a(n) = 6*floor(n/5) + [0,0,2,3,4][n%5].
G.f.: (2*x^5 + x^4 + x^3 + 2*x^2)/((1-x)*(1-x^5)). (End)
a(n) = n - 1 + floor(n/5) + ceiling((n-1)/5) - floor((n-1)/5). - Wesley Ivan Hurt, Mar 29 2014
MAPLE
A239492:=n->n-1+floor(n/5)+ceil((n-1)/5)-floor((n-1)/5); seq(A239492(n), n=0..50); # Wesley Ivan Hurt, Mar 29 2014
MATHEMATICA
a[n_] := Max[Table[Min[x*y, (5-x)*(n-y)], {x, 0, 5}, {y, 0, n}]]
Table[n - 1 + Floor[n/5] + Ceiling[(n - 1)/5] - Floor[(n - 1)/5], {n, 0, 50}] (* Wesley Ivan Hurt, Mar 29 2014 *)
CoefficientList[Series[(2 x^5 + x^4 + x^3 + 2 x^2)/((1 - x) (1 - x^5)), {x, 0, 100}], x] (* Vincenzo Librandi, Mar 30 2014 *)
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Robin Houston, Mar 23 2014
STATUS
approved