OFFSET
1,1
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..200
Steve Butler, Persi Diaconis and R. L. Graham, The mathematics of the flip and horseshoe shuffles, arXiv:1412.8533 [math.CO], 2014.
Steve Butler, Persi Diaconis and R. L. Graham, The mathematics of the flip and horseshoe shuffles, The American Mathematical Monthly 123.6 (2016): 542-556.
P. Diaconis, R. L. Graham and W. M. Kantor, The mathematics of perfect shuffles, Adv. Appl. Math. 4 (2) (1983) 175-196.
FORMULA
See Maple program. - N. J. A. Sloane, Jun 20 2016
MAPLE
f:=proc(n) local k, i, np;
if n=1 then 2
elif (n mod 2) = 1 then n!*2^(n-1)
elif n=6 then 2^9*3*5
elif n=12 then 2^17*3^3*5*11
elif n=2 then 8
elif (n mod 4)=2 then n!*2^n
else
np:=n; k:=1;
for i while (np mod 2) = 0 do
np:=np/2; k:=k+1; od;
if (n=2^(k-1)) then k*2^k else n!*2^(n-2); fi;
fi;
end;
[seq(f(n), n=1..64)]; # N. J. A. Sloane, Jun 20 2016
MATHEMATICA
a[1] = 2; a[2] = 8; a[n_] := With[{m = 2^n*n!}, Which[Mod[n, 4] == 2, If[n == 6, m/6, m], Mod[n, 4] == 1, m/2, Mod[n, 4] == 3, m/2, True, If[n == 2^IntegerExponent[n, 2], 2*n*(IntegerExponent[n, 2] + 1), If[n == 12, m/(2*7!), m/4]]]]; Table[a[n], {n, 1, 19}](* Jean-François Alcover, Feb 17 2012, after Franklin T. Adams-Watters *)
PROG
(PARI) A007346(n) = local(M); M=2^n*n!; if(n%4==2, if(n==2, 8, if(n==6, M/6, M)), if(n%4==1, if(n==1, 2, M/2), if(n%4==3, M/2, if(n==2^valuation(n, 2), 2*n*(valuation(n, 2)+1), if(n==12, M/(7!*2), M/4))))) \\ Franklin T. Adams-Watters, Nov 30 2006
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
Corrected and extended by Franklin T. Adams-Watters, Nov 30 2006
STATUS
approved