login
A275111
a(n) = prime(n)! mod prime(n+1).
5
2, 1, 1, 2, 1, 3, 1, 4, 22, 1, 33, 7, 1, 8, 19, 30, 1, 43, 12, 1, 27, 14, 23, 24, 17, 1, 18, 1, 19, 19, 22, 8, 1, 94, 1, 140, 72, 28, 62, 91, 1, 105, 1, 33, 1, 177, 97, 38, 1, 39, 2, 1, 19, 15, 160, 204, 1, 247, 47, 1, 291, 299, 52, 1, 53, 198, 132, 55, 1, 59, 3, 176
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
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