%I #43 May 08 2020 17:33:00
%S 1,1,1,3,3,15,5,35,35,315,63,693,231,3003,429,6435,6435,109395,12155,
%T 230945,46189,969969,88179,2028117,676039,16900975,1300075,35102025,
%U 5014575,145422675,9694845,300540195,300540195,9917826435,583401555,20419054425,2268783825
%N Odd part of the swinging factorial A056040.
%C Let n$ denote the swinging factorial. a(n) = n$ / 2^sigma(n) where sigma(n) is the exponent of 2 in the prime-factorization of n$. sigma(n) can be computed as the number of '1's in the base 2 representation of floor(n/2).
%C If n is even then a(n) is the numerator of the reduced ratio (n-1)!!/n!! = A001147(n-1)/A000165(n), and if n is odd then a(n) is the numerator of the reduced ratio n!!/(n-1)!! = A001147(n)/A000165(n-1). The denominators for each ratio should be compared to A060818. Here all ratios are reduced. - _Anthony Hernandez_, Feb 05 2020 [See the Mathematica program for a more compact form of the formula. _Peter Luschny_, Mar 01 2020 ]
%H G. C. Greubel, <a href="/A163590/b163590.txt">Table of n, a(n) for n = 0..1000</a>
%H Peter Luschny, <a href="/A180000/a180000.pdf">Die schwingende Fakultät und Orbitalsysteme</a>, August 2011.
%H Peter Luschny, <a href="http://luschny.de/math/factorial/SwingIntro.pdf">Swinging Factorial.</a>
%F a(2*n) = A001790(n).
%F a(2*n+1) = A001803(n).
%F a(n) = a(n-1)*n^((-1)^(n+1))*2^valuation(n, 2) for n > 0. - _Peter Luschny_, Sep 29 2019
%e 11$ = 2772 = 2^2*3^2*7*11. Therefore a(11) = 3^2*7*11 = 2772/4 = 693.
%e From _Anthony Hernandez_, Feb 04 2019: (Start)
%e a(7) = numerator((1*3*5*7)/(2*4*6)) = 35;
%e a(8) = numerator((1*3*5*7)/(2*4*6*8)) = 35;
%e a(9) = numerator((1*3*5*7*9)/(2*4*6*8)) = 315;
%e a(10) = numerator((1*3*5*7*9)/(2*4*6*8*10)) = 63. (End)
%p swing := proc(n) option remember; if n = 0 then 1 elif irem(n, 2) = 1 then swing(n-1)*n else 4*swing(n-1)/n fi end:
%p sigma := n -> 2^(add(i,i= convert(iquo(n,2),base,2))):
%p a := n -> swing(n)/sigma(n);
%t sf[n_] := With[{f = Floor[n/2]}, Pochhammer[f+1, n-f]/ f!]; a[n_] := With[{s = sf[n]}, s/2^IntegerExponent[s, 2]]; Table[a[n], {n, 0, 31}] (* _Jean-François Alcover_, Jul 26 2013 *)
%t r[n_] := (n - Mod[n - 1, 2])!! /(n - 1 + Mod[n - 1, 2])!! ;
%t Table[r[n], {n, 0, 36}] // Numerator (* _Peter Luschny_, Mar 01 2020 *)
%o (Sage) # uses[A000120]
%o @CachedFunction
%o def swing(n):
%o if n == 0: return 1
%o return swing(n-1)*n if is_odd(n) else 4*swing(n-1)/n
%o A163590 = lambda n: swing(n)/2^A000120(n//2)
%o [A163590(n) for n in (0..31)] # _Peter Luschny_, Nov 19 2012
%o # Alternatively:
%o (Sage)
%o @cached_function
%o def A163590(n):
%o if n == 0: return 1
%o return A163590(n - 1) * n^((-1)^(n + 1)) * 2^valuation(n, 2)
%o print([A163590(n) for n in (0..31)]) # _Peter Luschny_, Sep 29 2019
%o (PARI)
%o A163590(n) = {
%o my(a = vector(n+1)); a[1] = 1;
%o for(n = 1, n,
%o a[n+1] = a[n]*n^((-1)^(n+1))*2^valuation(n, 2));
%o a } \\ _Peter Luschny_, Sep 29 2019
%Y Cf. A056040, A060632, A001790, A001803.
%K nonn
%O 0,4
%A _Peter Luschny_, Aug 01 2009