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

%I #30 Feb 24 2023 02:31:10

%S 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,

%T 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,

%U 15,160,204,1,247,47,1,291,299,52,1,53,198,132,55,1,59,3,176

%N a(n) = prime(n)! mod prime(n+1).

%C By Wilson's theorem, if prime(n+1) - prime(n) = 2 then a(n) = 1.

%C However a(991) = 1, while prime(992) - prime(991) = 7853 - 7841 = 12. See A286181, A286208, A286230. - _Robert Israel_, Jul 17 2016

%H Chai Wah Wu, <a href="/A275111/b275111.txt">Table of n, a(n) for n = 1..10000</a>

%F 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

%F 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

%t Table[Mod[#!, NextPrime@ #] &@ Prime@ n, {n, 120}] (* _Michael De Vlieger_, Jul 17 2016 *)

%o (PARI) a(n) = prime(n)! % prime(n+1); \\ _Michel Marcus_, Jul 17 2016

%o (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

%o (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

%o (Python)

%o from sympy import prime

%o from sympy.core.numbers import igcdex

%o def A275111(n):

%o p, q = prime(n), prime(n+1)

%o a = q-1

%o for i in range(p+1,q):

%o a = (a*igcdex(i,q)[0]) % q

%o return a # _Chai Wah Wu_, Jul 18 2016

%o (Python)

%o from functools import reduce

%o from sympy import prime

%o 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

%Y Cf. A286181, A286208, A286230.

%K nonn

%O 1,1

%A _Thomas Ordowski_, Jul 17 2016

%E More terms from _Altug Alkan_, Jul 17 2016

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 19:24 EDT 2024. Contains 371962 sequences. (Running on oeis4.)