login
A145787
Number of times you have to move n cards from one pile to another doing one up, one down, until you obtain the initial sequence.
1
1, 2, 2, 3, 3, 6, 6, 4, 4, 6, 6, 10, 10, 14, 14, 5, 5, 18, 18, 10, 10, 12, 12, 21, 21, 26, 26, 9, 9, 30, 30, 6, 6, 22, 22, 9, 9, 30, 30, 27, 27, 8, 8, 11, 11, 10, 10, 24, 24, 50, 50, 12, 12, 18, 18, 14, 14, 12, 12, 55, 55, 50, 50, 7, 7, 18, 18, 34, 34, 46, 46
OFFSET
1,2
COMMENTS
Let's say you have 3 cards (1 - 2 - 3). You move 1, 2 over 1, 3 below 2. Now you have: (2-1-3). Now you repeat the movement: You move 2, 1 over 2, 3 below 2. Now you have: (1-2-3). The same initial scenario. Total 2 moves. With 4 cards you do it in three moves. For 8 cards you need 4 moves. For 16 cards you need 5 moves. I can assume that for 32 cards I will do it in 6 moves. But for 14 or 15 cards you need 14 moves. I don't know how to predict how many moves for n cards...
FORMULA
a(n) = A019567(floor(n/2)). - Jon Maiga, Oct 06 2019
MATHEMATICA
A019567[n_]:=For[m=1, True, m++, If[AnyTrue[{-1, 1}, Divisible[2^m+#, 4n+1]&], Return[m]]]; (* from A019567 *)
Table[A019567[Floor[n/2]], {n, 80}] (* Jon Maiga, Oct 06 2019 *)
PROG
(PARI)
deck(n) = {s = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,; :!?.*%$£€=+-&()[]{}_"; v = Vec(s); ss = ""; for (i=1, n, ss = concat(ss, v[i]); ); return (ss); }
move(cards) = {v = Vec(cards); s = ""; for (i=1, length(v), if (i % 2, s = concat(s, v[i]), s = concat(v[i], s)); ); return (s); }
a(n) = {cardsa = deck(n); cardsb = cardsa; diff = 1; nb = 0; while (diff, cardsb = move(cardsb); diff = (cardsa != cardsb); nb++; ); return (nb); }
\\ Michel Marcus, Mar 05 2013
CROSSREFS
Cf. A019567.
Sequence in context: A116417 A271410 A196055 * A096111 A358337 A101081
KEYWORD
nonn
AUTHOR
Hernan Bonsembiante (hernanbon(AT)tutopia.com), Oct 19 2008
EXTENSIONS
More terms from Michel Marcus, Mar 05 2013
STATUS
approved