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.

Showing 1-4 of 4 results.

A062282 Number of permutations of n elements with an even number of fixed points.

Original entry on oeis.org

1, 0, 2, 2, 16, 64, 416, 2848, 22912, 205952, 2060032, 22659328, 271913984, 3534877696, 49488295936, 742324422656, 11877190795264, 201912243453952, 3634420382302208, 69053987263479808, 1381079745270120448, 29002674650671480832, 638058842314774675456
Offset: 0

Views

Author

Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 04 2001

Keywords

Comments

Let d(n) be the number of derangements of n elements (sequence A000166) then a(n) has the recursion: a(n) = d(n) + C(n,2)*d(n-2) + C(n,4)*d(n-4) + C(n,6)*d(n-6)... = A000166(n) + A000387(n) + A000475(n) + C(n,6)*d(n-6)... The E.g.f. for a(n) is: cosh(x) * exp(-x)/(1-x) and the asymptotic expression for a(n) is: a(n) ~ n! * (1 + 1/e^2)/2 i.e., as n goes to infinity the fraction of permutations that has an even number of fixed points is about (1 + 1/e^2)/2 = 0.567667...

Crossrefs

Programs

  • Mathematica
    nn = 20; d = Exp[-x]/(1 - x); Range[0, nn]! CoefficientList[Series[Cosh[x] d, {x, 0, nn}], x] (* Geoffrey Critzer, Jan 14 2012 *)
    Table[Sum[Sum[(-1)^j * n!/(j!*(2*k)!), {j, 0, n - 2*k}], {k, 0, Floor[n/2]}], {n,0,50}] (* G. C. Greubel, Aug 21 2017 *)
  • PARI
    for(n=0,50, print1(sum(k=0,n\2, sum(j=0,n-2*k, (-1)^j*n!/(j!*(2*k)!))), ", ")) \\ G. C. Greubel, Aug 21 2017

Formula

a(n) = Sum_{k=0..[n/2]} Sum_{l=0..(n-2*k)} (-1)^l * n!/((2*k)! * l!).
More generally, e.g.f. for number of degree-n permutations with an even number of k-cycles is cosh(x^k/k)*exp(-x^k/k)/(1-x). - Vladeta Jovovic, Jan 31 2006
E.g.f.: 1/(1-x)/(x*E(0)+1), where E(k) = 1 - x^2/( x^2 + (2*k+1)*(2*k+3)/E(k+1) ); (continued fraction ). - Sergei N. Gladkovskii, Dec 29 2013
Conjecture: a(n) = Sum_{k=0..n} A008290(n, k)*A059841(k). - John Keith, Jun 30 2020

Extensions

More terms from Vladeta Jovovic, Jul 05 2001

A088336 Number of permutations in the symmetric group S_n that have even number of transpositions in their cycle decomposition.

Original entry on oeis.org

1, 1, 1, 3, 18, 90, 480, 3360, 27720, 249480, 2479680, 27276480, 327650400, 4259455200, 59623724160, 894355862400, 14309953257600, 243269205379200, 4378836875212800, 83197900629043200, 1663958347802150400, 34943125303845158400, 768748742605299456000
Offset: 0

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Nov 07 2003

Keywords

Crossrefs

Programs

  • Mathematica
    mx = 21; Rest[ Range[0, mx]! CoefficientList[ Series[(Exp[-x^2] + 1)/(1 - x)/2, {x, 0, mx}], x]] (* Robert G. Wilson v, May 04 2013 *)
  • PARI
    x='x+O('x^50); Vec(serlaplace((exp(-x^2)+1)/(1-x)/2)) \\ G. C. Greubel, Aug 20 2017

Formula

E.g.f.: (exp(-x^2)+1)/(1-x)/2. - Vladeta Jovovic, Nov 09 2003
a(n) ~ n! * (1+exp(-1))/2. - Vaclav Kotesovec, Oct 08 2013

Extensions

More terms from Robert G. Wilson v, May 04 2013
a(0) = 1 prepended by Alois P. Heinz, Jun 14 2015

A113979 Number of compositions of n with an even number of 1's.

Original entry on oeis.org

1, 0, 2, 1, 6, 6, 20, 28, 72, 120, 272, 496, 1056, 2016, 4160, 8128, 16512, 32640, 65792, 130816, 262656, 523776, 1049600, 2096128, 4196352, 8386560, 16781312, 33550336, 67117056, 134209536, 268451840, 536854528, 1073774592, 2147450880
Offset: 0

Views

Author

Vladeta Jovovic, Jan 31 2006

Keywords

Comments

More generally, the g.f. for the number of compositions such that part m occurs with even multiplicity is (1-x)/(1-2*x)*(1-2*x+x^m-x^(m+1))/(1-2*x+2*x^m-2*x^(m+1)). - Vladeta Jovovic, Sep 01 2007

Examples

			a(4)=6 because the compositions of 4 having an even number of 1's are 4,22,211,121,112 and 1111 (the other compositions of 4 are 31 and 13).
		

Crossrefs

Programs

  • Maple
    a:=proc(n) if n mod 2 = 0 then 2^(n-2)+2^((n-2)/2) else 2^(n-2)-2^((n-3)/2) fi end: seq(a(n),n=1..38); # Emeric Deutsch, Feb 01 2006
  • Mathematica
    f[n_] := If[ EvenQ[n], 2^(n - 2) + 2^((n - 2)/2), 2^(n - 2) - 2^((n - 3)/2)]; Array[f, 34] (* Robert G. Wilson v, Feb 01 2006 *)
  • PARI
    a(n) = n-=2; (n==-2) + 1<=0, (-1)^n << (n>>1)); \\ Kevin Ryde, May 02 2023

Formula

a(0) = 1, a(n) = 2^(n-2) + 2^((n-2)/2) if n is positive and even, otherwise a(n) = 2^(n-2) - 2^((n-3)/2).
G.f.: (1-z)*(1-z-z^2)/((1-2*z)*(1-2*z^2)). - Emeric Deutsch, Feb 03 2006
E.g.f.: (1 + exp(2*x) - sqrt(2)*sinh(x*sqrt(2)) + 2*cosh(x*sqrt(2)))/4. - Sergei N. Gladkovskii, Nov 18 2011
a(k) = (1/4)*0^k + (1/4)*2^k + (1/8)*(2-sqrt(2))*(sqrt(2))^k + (1/8)*(2+sqrt(2))*(-sqrt(2))^k. - Sergei N. Gladkovskii, Nov 18 2011

Extensions

More terms from Robert G. Wilson v and Emeric Deutsch, Feb 01 2006
a(0)=1 prepended and formulas corrected by Jason Yuen, Sep 09 2024

A113980 Number of compositions of n with an odd number of 1's.

Original entry on oeis.org

1, 0, 3, 2, 10, 12, 36, 56, 136, 240, 528, 992, 2080, 4032, 8256, 16256, 32896, 65280, 131328, 261632, 524800, 1047552, 2098176, 4192256, 8390656, 16773120, 33558528, 67100672, 134225920, 268419072, 536887296, 1073709056, 2147516416
Offset: 1

Views

Author

Vladeta Jovovic, Jan 31 2006

Keywords

Examples

			a(4)=2 because only the compositions 31 and 13 of 4 have an odd number of 1's (the other compositions are 4,22,211,121,112 and 1111).
		

Crossrefs

Programs

  • Maple
    a:=proc(n) if n mod 2 = 0 then 2^(n-2)-2^((n-2)/2) else 2^(n-2)+2^((n-3)/2) fi end: seq(a(n),n=1..38); # Emeric Deutsch, Feb 01 2006
  • Mathematica
    f[n_] := If[EvenQ[n], 2^(n - 2) - 2^((n - 2)/2), 2^(n - 2) + 2^((n - 3)/2)]; Array[f, 34] (* Robert G. Wilson v, Feb 01 2006 *)

Formula

a(n) = 2^(n-2)-2^((n-2)/2) if n is even, else a(n) = 2^(n-2)+2^((n-3)/2).
G.f.: z(1-z)^2/[(1-2z)(1-2z^2)]. - Emeric Deutsch, Feb 03 2006
G.f.: 1 + x + Q(0), where Q(k)= 1 - 1/(2^k - 2*x*2^(2*k)/(2*x*2^k - 1/(1 + 1/(2*2^k - 8*x*2^(2*k)/(4*x*2^k + 1/Q(k+1)))))); (continued fraction). - Sergei N. Gladkovskii, May 22 2013

Extensions

More terms from Robert G. Wilson v and Emeric Deutsch, Feb 01 2006
Showing 1-4 of 4 results.