login
Integers q for which f(q) = ((((q - 1)! + 1) / q) + 1) / (q + 1) is a prime number.
1

%I #34 Sep 08 2022 08:46:23

%S 7,17,31,67,89

%N Integers q for which f(q) = ((((q - 1)! + 1) / q) + 1) / (q + 1) is a prime number.

%C f(89) is a 131-digit prime.

%C According to Wilson's theorem, f(q) can be an integer only if q is prime.

%t Select[Prime[Range[100]], PrimeQ[((((# - 1)! + 1) / #) + 1) / (# + 1)] &] (* _Vincenzo Librandi_, Sep 21 2018 *)

%o (PARI) forprime(q=7, 89, my(p = ((((q - 1)! + 1) / q) + 1) / (q + 1)); if(ispseudoprime(p), print1(q, ", ")))

%o (Magma) [n: n in [1..100] | IsPrime(n) and IsPrime((((Factorial(n-1)+1) div n)+1) div (n+1))]; // _Vincenzo Librandi_, Sep 21 2018

%Y Cf. A193447, A319224.

%K nonn,hard,more

%O 1,1

%A _Rashid Naimi_, Sep 16 2018

%E 1621 and 1699, which do not belong here, removed by _Rashid Naimi_, Mar 21 2019