A157829 Numbers k such that k! - (k-1)! + (k-2)! + 1 is prime.
2, 5, 7, 11, 13, 16, 22, 29, 43, 56, 67, 83, 85, 107, 317, 325, 517, 1660, 2010, 2368, 4483, 4697, 14524
Offset: 1
Examples
a(11) = 11! - 10! + 9! + 1 = 36650881 (prime). a(16) = 16! - 15! + 14! + 1 = 19702293811201 (prime).
Programs
-
Maple
a := proc (n) if isprime(factorial(n-2)*((n-1)^2+1)+1) = true then n else end if end proc: seq(a(n), n = 2 .. 700); # Emeric Deutsch, Mar 18 2009
-
PARI
is(n)=ispseudoprime(1+(n^2-2*n+2)*(n-2)!) \\ Charles R Greathouse IV, Dec 27 2013
-
PFGW
ABC2 $a!-($a-1)!+($a-2)!+1 a: from 2 to 10000 Charles R Greathouse IV, Dec 27 2013
Extensions
More terms from Emeric Deutsch, Mar 18 2009
a(18)-a(22) from Charles R Greathouse IV, Dec 27 2013
a(23) from Michael S. Branicky, Jan 04 2025