login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
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
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
Sequence in context: A113279 A213234 A034807 * A182961 A339814 A135062
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Jul 17 2016
EXTENSIONS
More terms from Altug Alkan, Jul 17 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)