cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A275111 a(n) = prime(n)! mod prime(n+1).

Original entry on oeis.org

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

Views

Author

Thomas Ordowski, Jul 17 2016

Keywords

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

Crossrefs

Programs

  • Mathematica
    Table[Mod[#!, NextPrime@ #] &@ Prime@ n, {n, 120}] (* Michael De Vlieger, Jul 17 2016 *)
  • 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

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

Extensions

More terms from Altug Alkan, Jul 17 2016

A286181 Lesser of Wilson's pseudo-twin primes: primes p such that p! == 1 (mod q), where q=A151800(p) is the next prime after p, and q-p>2.

Original entry on oeis.org

7841, 594278556271608991, 4259842839142238791410741595983041626644087433
Offset: 1

Views

Author

Max Alekseyev and Thomas Ordowski, May 04 2017

Keywords

Comments

By Wilson's theorem, p! == 1 (mod p+2) whenever p,p+2 are twin primes. This sequence and A286208 concern consecutive primes p,q satisfying p! = 1 (mod q), where d = q-p > 2.
It follows that (d-1)! == 1 (mod q), and so q divides A033312(d-1).
Listed terms correspond to d = 12, 30, 76 (cf. A286230). Further terms should have d>=140.
Also, primes p=prime(n) such that A275111(n)=1, and (prime(n),prime(n+1)) are not twin primes (i.e., p is not a term of A001359).

Examples

			For a(1)=7841, we have 7841! == 1 (mod 7853), where 7841 and 7853=7841+12 are consecutive primes. Also, 7853 | (12-1)!-1.
		

Crossrefs

A286230 Possible differences between consecutive primes p, q satisfying p! == 1 (mod q).

Original entry on oeis.org

2, 12, 30, 76
Offset: 1

Views

Author

Max Alekseyev, May 04 2017

Keywords

Comments

By Wilson's theorem, p! == 1 (mod p+2) whenever p, p+2 are twin primes, so 2 is a term.
Terms d > 2 correspond to Wilson's pseudo-twin primes, i.e., consecutive primes p, q such that q - p = d and p! == 1 (mod q). The corresponding primes are listed in A286181 and A286208.
As a set, the sequence is the union of {2} and the differences {A286208(n) - A286181(n)}.
A positive integer d belongs to this sequence if A033312(d-1) = (d-1)! - 1 has a prime factor q such that q - A151799(q) = d.
All terms are even.
If it exists, a(5) >= 140.

Crossrefs

Showing 1-3 of 3 results.