login
Subfactorial primes: primes of the form !n + 1 or !n - 1. Subfactorial or rencontres numbers or derangements !n = A000166.
2

%I #10 Feb 17 2023 21:16:50

%S 2,3,43,481066515733,130850092279663

%N Subfactorial primes: primes of the form !n + 1 or !n - 1. Subfactorial or rencontres numbers or derangements !n = A000166.

%C No additional terms through n <= 2000. (* _Harvey P. Dale_, Feb 17 2023 *)

%D R. A. Brualdi and H. J. Ryser: Combinatorial Matrix Theory, 1992, Section 7.2, p. 202.

%D H. J. Ryser, Combinatorial Mathematics. Mathematical Association of America, Carus Mathematical Monograph 14, 1963, p. 23.

%H R. M. Dickau, <a href="http://mathforum.org/advanced/robertd/derangements.html">Derangement diagrams</a>.

%H H. Fripertinger, <a href="http://webdb.uni-graz.at/~fripert/fga/k1recontre.html">The Recontre Numbers</a>, an online calculator.

%H Mehdi Hassani, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL6/Hassani/hassani5.html">Derangements and Applications</a>, Journal of Integer Sequences, Vol. 6 (2003), #03.1.2

%e a(5) = 130850092279663 because the 5th subfactorial prime is !17 - 1 = 130850092279664 - 1 = 130850092279663. a(1) = 2 because !0 = !2 = 1, so !0 + 1 = !2 + 1 = 2.

%t Select[Union[Flatten[Table[Subfactorial[n]+{1,-1},{n,20}]]],PrimeQ] (* _Harvey P. Dale_, Feb 17 2023 *)

%Y Cf. A000166.

%K nonn

%O 1,1

%A _Jonathan Vos Post_, Nov 18 2004