OFFSET
0,4
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 = 0..100
Bashir Ali and A. Umar, Some combinatorial properties of the alternating group, Southeast Asian Bulletin Math. 32 (2008), 823-830. [From Abdullahi Umar, Oct 09 2008]
L. Carlitz and R. A. Scoville, Problem E2354, Amer. Math. Monthly, 79 (1972), 394.
G. Gordon and E. McMahon, Moving faces to other places: facet derangements, Amer. Math. Monthly, 117 (2010), 865-88.
G. Gordon and E. McMahon, Moving faces to other places: facet derangements, arXiv:0906.4253 [math.CO], 2009.
Karen Meagher, Peter Sin, All 2-transitive groups have the EKR-module property, arXiv:1911.11252 [math.CO], 2019.
Piotr Miska, Arithmetic Properties of the Sequence of Derangements and its Generalizations, arXiv:1508.01987 [math.NT], 2015. (see Chapter 5 p. 44)
J. M. Thomas, The number of even and odd absolute permutations of n letters, Bull. Amer. Math. Soc. 31 (1925), 303-304.
FORMULA
a(n) = (A000166(n)-(-1)^n*(n-1))/2.
From Abdullahi Umar, Oct 09 2008: (Start)
a(n) = (n!/2)*sum(((-1)^i)/i!, i=0..n-2)+((-1)^(n-1))*(n-1) for n>1, a(0)=1, a(1)=0.
a(n) = (n-1)*(a(n-1)+a(n-2))+((-1)^(n-1))*(n-1) for n>1, a(0)=1, a(1)=0.
a(n) = n*a(n-1)+((-1)^(n-1))*(n-2)*(n+1)/2 for n>0, a(0)=1.
E.g.f.: (1-x^2/2)*exp(-x)/(1-x). (End)
MAPLE
A003221 := n -> ((-1)^n*hypergeom([-n, 1], [], 1)-(-1)^n*(n-1))/2:
seq(simplify(A003221(n)), n=0..22); # Peter Luschny, May 09 2017
MATHEMATICA
a[n_] := (Round[n!/E] - (-1)^n*(n - 1))/2; a[0] = 1; Table[a[n], {n, 0, 22}] (* Jean-François Alcover, Dec 13 2011, after Simon Plouffe *)
Range[0, 25]! CoefficientList[Series[(1 - x^2 / 2) E^(-x) / (1 - x), {x, 0, 25}], x] (* Vincenzo Librandi, Aug 11 2015 *)
PROG
(Python)
from __future__ import division
A003221_list, m, x = [], -1, 0
for n in range(10*2):
....x, m = x*n + m*(n*(n-1)//2-1), -m
....A003221_list.append(x) # Chai Wah Wu, Nov 03 2014
(PARI) a(n) = ( n!*sum(r=2, n, (-1)^r/r!) + (-1)^(n-1)*(n-1))/2; \\ Michel Marcus, Apr 22 2016
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
EXTENSIONS
Typo in second formula fixed by Josh Swanson, Nov 10 2013
STATUS
approved