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-4 of 4 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

A286208 Greater of Wilson's pseudo-twin primes: primes q such that p! == 1 (mod q), where p=A151799(q) is the previous prime before q, and q-p>2.

Original entry on oeis.org

7853, 594278556271609021, 4259842839142238791410741595983041626644087509
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 A286181 concern consecutive primes (p,q) satisfying p! = 1 (mod q), where d = q-p > 2.
It follows that (d-1)! == 1 (mod q). Listed terms correspond to d = 12, 30, 76 (cf. A286230). Further terms should have d>=140.
Also, primes q=prime(n) such that A275111(n-1)=1, and (prime(n-1),prime(n)) are not twin primes (i.e., q is not a term of A006512).

Crossrefs

Subsequence of A166864.

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

A096292 Primes p such that p!-1 is divisible by the next prime larger than p.

Original entry on oeis.org

3, 5, 11, 17, 29, 41, 59, 71, 101, 107, 137, 149, 179, 191, 197, 227, 239, 269, 281, 311, 347, 419, 431, 461, 521, 569, 599, 617, 641, 659, 809, 821, 827, 857, 881, 1019, 1031, 1049, 1061, 1091, 1151, 1229, 1277, 1289, 1301, 1319, 1427, 1451, 1481, 1487, 1607
Offset: 1

Views

Author

Stuart Gascoigne (stuart.g(AT)scoigne.com), Jun 24 2004

Keywords

Comments

This sequence includes A001359 as a subset, since the lesser of twin primes always satisfy this relation. The smallest number in this sequence that is not in A001359 is 7841. The only other known differences are 594278556271608991 and 4259842839142238791410741595983041626644087433.

Examples

			17 is here because 17!-1 is divisible by 19 and 19 is the next prime larger than 17.
		

Crossrefs

Programs

  • PARI
    p=2; forprime(q=3, , prod(j=1, p, Mod(j, q)) == 1 && print1(p, ", "); p=q) \\ Jeppe Stig Nielsen, Oct 04 2019
Showing 1-4 of 4 results.