OFFSET
1,1
COMMENTS
By Wilson's theorem, if prime(n+1) - prime(n) = 2 then a(n) = 1.
However a(991) = 1, while prime(992) - prime(991) = 7853 - 7841 = 12. See A286181, A286208, A286230. - Robert Israel, Jul 17 2016
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
FORMULA
For n>1, a(n) = 1/((prime(n)+1)*(prime(n)+2)*...*(prime(n+1)-2)) mod prime(n+1). - Robert Israel, Jul 17 2016; corrected by Max Alekseyev, May 03 2017
For n>1, a(n) = 1/(prime(n+1)-prime(n)-1)! mod prime(n+1) = 1/(A001223(n)-1)! mod A000040(n+1). - Max Alekseyev, May 03 2017
MATHEMATICA
Table[Mod[#!, NextPrime@ #] &@ Prime@ n, {n, 120}] (* Michael De Vlieger, Jul 17 2016 *)
PROG
(PARI) a(n) = prime(n)! % prime(n+1); \\ Michel Marcus, Jul 17 2016
(PARI) a(n, p=prime(n))=my(q=nextprime(p+1)); if(p==2, 2, lift( 1/prod(r=p+1, q-2, Mod(r, q)) ) ); \\ Charles R Greathouse IV, Jul 18 2016; corrected by Max Alekseyev, May 03 2017
(PARI) a(n, p=prime(n)) = my(q=nextprime(p+1)); if(p==2, 2, (1/(q-p-1)!)%q); \\ Max Alekseyev, May 03 2017
(Python)
from sympy import prime
from sympy.core.numbers import igcdex
def A275111(n):
p, q = prime(n), prime(n+1)
a = q-1
for i in range(p+1, q):
a = (a*igcdex(i, q)[0]) % q
return a # Chai Wah Wu, Jul 18 2016
(Python)
from functools import reduce
from sympy import prime
def A275111(n): return ((q:=prime(n+1))-1)*pow(reduce(lambda i, j:i*j%q, range(prime(n)+1, q), 1), -1, q)%q # Chai Wah Wu, Feb 24 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Jul 17 2016
EXTENSIONS
More terms from Altug Alkan, Jul 17 2016
STATUS
approved