cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A163590 Odd part of the swinging factorial A056040.

Original entry on oeis.org

1, 1, 1, 3, 3, 15, 5, 35, 35, 315, 63, 693, 231, 3003, 429, 6435, 6435, 109395, 12155, 230945, 46189, 969969, 88179, 2028117, 676039, 16900975, 1300075, 35102025, 5014575, 145422675, 9694845, 300540195, 300540195, 9917826435, 583401555, 20419054425, 2268783825
Offset: 0

Views

Author

Peter Luschny, Aug 01 2009

Keywords

Comments

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).
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 ]

Examples

			11$ = 2772 = 2^2*3^2*7*11. Therefore a(11) = 3^2*7*11 = 2772/4 = 693.
From _Anthony Hernandez_, Feb 04 2019: (Start)
a(7) = numerator((1*3*5*7)/(2*4*6)) = 35;
a(8) = numerator((1*3*5*7)/(2*4*6*8)) = 35;
a(9) = numerator((1*3*5*7*9)/(2*4*6*8)) = 315;
a(10) = numerator((1*3*5*7*9)/(2*4*6*8*10)) = 63. (End)
		

Crossrefs

Programs

  • Maple
    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:
    sigma := n -> 2^(add(i,i= convert(iquo(n,2),base,2))):
    a := n -> swing(n)/sigma(n);
  • Mathematica
    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 *)
    r[n_] := (n - Mod[n - 1, 2])!! /(n - 1 + Mod[n - 1, 2])!! ;
    Table[r[n], {n, 0, 36}] // Numerator (* Peter Luschny, Mar 01 2020 *)
  • PARI
    A163590(n) = {
        my(a = vector(n+1)); a[1] = 1;
        for(n = 1, n,
            a[n+1] = a[n]*n^((-1)^(n+1))*2^valuation(n, 2));
    a } \\ Peter Luschny, Sep 29 2019
  • Sage
    # uses[A000120]
    @CachedFunction
    def swing(n):
        if n == 0: return 1
        return swing(n-1)*n if is_odd(n) else 4*swing(n-1)/n
    A163590 = lambda n: swing(n)/2^A000120(n//2)
    [A163590(n) for n in (0..31)]  # Peter Luschny, Nov 19 2012
    # Alternatively:
    
  • Sage
    @cached_function
    def A163590(n):
        if n == 0: return 1
        return A163590(n - 1) * n^((-1)^(n + 1)) * 2^valuation(n, 2)
    print([A163590(n) for n in (0..31)]) # Peter Luschny, Sep 29 2019
    

Formula

a(2*n) = A001790(n).
a(2*n+1) = A001803(n).
a(n) = a(n-1)*n^((-1)^(n+1))*2^valuation(n, 2) for n > 0. - Peter Luschny, Sep 29 2019