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-7 of 7 results.

A163210 Swinging Wilson quotients ((p-1)$ +(-1)^floor((p+2)/2))/p, p prime. Here '$' denotes the swinging factorial function (A056040).

Original entry on oeis.org

1, 1, 1, 3, 23, 71, 757, 2559, 30671, 1383331, 5003791, 245273927, 3362110459, 12517624987, 175179377183, 9356953451851, 509614686432899, 1938763632210843, 107752663194272623
Offset: 1

Views

Author

Peter Luschny, Jul 24 2009

Keywords

Examples

			The 5th prime is 11, (11-1)$ = 252, the remainder term is (-1)^floor((11+2)/2)=1. So the quotient (252+1)/11 = 23 is the 5th member of the sequence.
		

Crossrefs

Programs

  • Maple
    swing := proc(n) option remember; if n = 0 then 1 elif irem(n, 2) = 1 then swing(n-1)*n else 4*swing(n-1)/n fi end:
    WQ := proc(f,r,n) map(p->(f(p-1)+r(p))/p,select(isprime,[$1..n])) end:
    A163210 := n -> WQ(swing,p->(-1)^iquo(p+2,2),n);
  • Mathematica
    sf[n_] := n!/Quotient[n, 2]!^2; a[n_] := (p = Prime[n]; (sf[p - 1] + (-1)^Floor[(p + 2)/2])/p); Table[a[n], {n, 1, 19}] (* Jean-François Alcover, Jun 28 2013 *)
    a[p_] := (Binomial[p-1, (p-1)/2] - (-1)^((p-1)/2)) / p
    Join[{1, 1}, a[Prime[Range[3,20]]]] (* Peter Luschny, May 13 2017 *)
  • PARI
    a(n, p=prime(n)) = ((p-1)!/((p-1)\2)!^2 - (-1)^(p\2))/p \\ David A. Corneth, May 13 2017

A079853 Primes p for which (p-2)! == 1 (mod p^2).

Original entry on oeis.org

2, 3, 11, 107, 4931
Offset: 1

Views

Author

Pavlos Saridis (pavlos19(AT)yahoo.com), Sep 13 2003

Keywords

Comments

These are generalized Wilson primes of order 2. Similarly to Wilson's theorem which states that (p-1)! == -1 (mod p) for every prime p>=n, we can prove that (n-1)!(p-n)! == (-1)^n (mod p) for every prime p. Generalized Wilson primes p of order n satisfy the recurrence (n-1)!(p-n)! == (-1)^n (mod p^2). Cf. A128666
Also, near-Wilson primes with Wilson quotient modulo p equals 1: prime p=prime(n) is in this sequence iff A002068(n) == A007619(n) == 1 (mod p).
Zhi-Wei SUN conjectures that for n>1, a(n) == 3 (mod 8). (Posting to the Number Theory Mailing List, Nov 02 2009; added by N. J. A. Sloane, Nov 02 2009)
No other terms below 4*10^11.
Conjecture: primes p such that Sum_{k=1..p-1} k^(1-p) == -1 (mod p^2) are the odd terms of this sequence. - Thomas Ordowski, Jul 02 2020

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[700]],Mod[(#-2)!,#^2]==1&] (* Harvey P. Dale, Jun 01 2014 *)
  • PARI
    forprime(n=2, 10^9, if(Mod((n-2)!, n^2)==1, print1(n, ", "))) \\ Felix Fröhlich, Jun 17 2014

Extensions

Edited by Max Alekseyev, Jan 28 2012

A163213 Swinging Wilson remainders ((p-1)$ + (-1)^floor((p+2)/2))/p mod p, p prime. Here '$' denotes the swinging factorial function (A056040).

Original entry on oeis.org

1, 1, 1, 3, 1, 6, 9, 13, 12, 2, 19, 2, 5, 36, 6, 19, 43, 11, 47, 67, 39, 41, 70, 12, 17, 83, 88, 81, 25, 53, 91, 97, 106, 79, 43, 39, 7, 29, 73, 6, 79, 115
Offset: 1

Views

Author

Peter Luschny, Jul 24 2009

Keywords

Comments

If this is zero, p is a swinging Wilson prime.

Examples

			The swinging Wilson quotient related to the 5th prime is (252+1)/11=23, so the 5th term is 23 mod 11 = 1.
		

Crossrefs

Programs

  • Maple
    WR := proc(f,r,n) map(p->(f(p-1)+r(p))/p mod p,select(isprime,[$1..n])) end:
    A002068 := n -> WR(factorial,p->1,n);
    A163213 := n -> WR(swing,p->(-1)^iquo(p+2,2),n);
  • Mathematica
    sf[n_] := n!/Quotient[n, 2]!^2; a[n_] := (p = Prime[n]; Mod[(sf[p - 1] + (-1)^Floor[(p + 2)/2])/p, p]); Table[a[n], {n, 1, 42}] (* Jean-François Alcover, Jun 28 2013 *)
  • PARI
    sf(n)=n!/(n\2)!^2
    apply(p->sf(p-1)\/p%p, primes(100)) \\ Charles R Greathouse IV, Dec 11 2016

A128666 Least generalized Wilson prime p such that p^2 divides (n-1)!(p-n)! - (-1)^n; or 0 if no such prime exists.

Original entry on oeis.org

5, 2, 7, 10429, 5, 11, 17
Offset: 1

Views

Author

Alexander Adamchuk, Mar 25 2007

Keywords

Comments

Conjecture: a(n)>0 for all n.
Wilson's theorem states that (p-1)! == -1 (mod p) for every prime p. Wilson primes are the primes p such that p^2 divides (p-1)! + 1. They are listed in A007540. Wilson's theorem can be expressed in general as (n-1)!(p-n)! == (-1)^n (mod p) for every prime p >= n. Generalized Wilson primes are the primes p such that p^2 divides (n-1)!(p-n)! - (-1)^n.
Alternatively, prime p=prime(k) is a generalized Wilson prime order n iff A002068(k) == A007619(k) == H(n-1) (mod p), where H(n-1) = A001008(n-1)/A002805(n-1) is (n-1)-st harmonic number.
Generalized Wilson primes of order 2 are listed in A079853. Generalized Wilson primes of order 17 are listed in A152413.
a(9)-a(11) = {541,11,17}.
a(13) = 13.
a(15)-a(21) = {349, 31, 61, 13151527, 71, 59, 217369}.
a(24) = 47.
a(26)-a(28) = {97579, 53, 347}.
a(30)-a(37) = {137, 20981, 71, 823, 149, 71, 4902101, 71}.
a(39)-a(45) = {491, 59, 977, 1192679, 47, 3307, 61}.
a(47) = 14197.
a(49) = 149.
a(51) = 3712567.
a(53)-a(65) = {71, 2887, 137, 35677, 467, 443, 636533, 17257, 2887, 80779, 173, 237487, 1013}.
a(67)-a(76) = {523, 373, 2341, 359, 409, 14273449, 5651, 7993, 28411, 419}.
a(78) = 227.
a(80)-a(81) = {33619,173}.
a(83) = 137.
a(85)-a(86) = {983, 6601909}.
a(88) = 859.
a(90) = 2267.
a(92)-a(94) = {1489,173,6970961}.
a(97) = 453161
a(100) = 4201.
For n<100, a(n) > 1.4*10^7 is currently not known for n in { 8, 12, 14, 22, 23, 25, 29, 31, 38, 46, 48, 50, 52, 66, 77, 79, 82, 84, 87, 89, 91, 95, 96, 98, 99 }.

Crossrefs

Formula

If it exists, a(n) >= n. a(n) = n for n in {2, 5, 13, 563, ...} = the union of prime 2 and Wilson primes A007540.

Extensions

Edited and updated by Alexander Adamchuk, Nov 06 2010
Edited and a(18), a(21), a(26), a(36), a(42), a(51), a(59), a(62), a(64), a(72), a(86), a(94), a(97) added by Max Alekseyev, Jan 29 2012
Edited by M. F. Hasler, Dec 31 2015

A152413 Generalized Wilson primes of order 17; or primes p such that p^2 divides 16!(p-17)! + 1.

Original entry on oeis.org

61, 251, 479
Offset: 1

Views

Author

Alexander Adamchuk, Dec 03 2008

Keywords

Comments

Wilson's theorem states that (p-1)! == -1 (mod p) for every prime p. Wilson primes are the primes p such that p^2 divides (p-1)! + 1. They are listed in A007540. Wilson's theorem can be expressed in general as (n-1)!(p-n)! == (-1)^n (mod p) for every prime p >= n. Generalized Wilson primes order n are the primes p such that p^2 divides (n-1)!(p-n)! - (-1)^n.
Alternatively, prime p=prime(k) is a generalized Wilson prime order n iff A002068(k) == A007619(k) == H(n-1) (mod p), where H(n-1) = A001008(n-1)/A002805(n-1) is (n-1)-st harmonic number. For this sequence (n=17), it reduces to A002068(k) == A007619(k) == 2436559/720720 (mod p).

Crossrefs

Extensions

Edited by Max Alekseyev, Jan 28 2012

A275741 Sum of Wilson and Lerch remainders of n-th prime.

Original entry on oeis.org

1, 3, 10, 6, 6, 17, 15, 11, 25, 38, 9, 37, 47, 39, 86, 58, 107, 50, 101, 36, 98, 45, 123, 92, 170, 57, 80, 72, 158, 194, 194, 67, 78, 133, 120, 302, 144, 158, 128, 97, 91, 303, 76, 191, 139, 178, 302, 117, 242, 179, 335, 390, 362, 197, 290, 314, 327, 227, 429
Offset: 2

Views

Author

Felix Fröhlich, Aug 07 2016

Keywords

Comments

a(n) = 0 if and only if prime(n) is in both A007540 and A197632, i.e., prime(n) is simultaneously a Wilson prime and a Lerch prime.
For n > 2, a(n) = 0 if and only if A027641(3*p-3) / A027642(3*p-3)-1 + 1/p == 0 (mod p^2), where p = prime(n) (cf. Dobson, 2016, theorem 2).
René Gy (see links) has shown that a number is simultaneously a Lerch prime and a Wilson prime if and only if it satisfies the congruence (p - 1)! + 1 == 0 (mod p^3). - John Blythe Dobson, Feb 23 2018

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = Prime[n]}, Mod[((p-1)!+1)/p, p] + Mod[(Sum[(k^(p-1)-1)/p, {k, 1, p-1}] - ((p-1)!+1)/p)/p, p]];
    Table[a[n], {n, 2, 60}] (* Jean-François Alcover, Feb 15 2019 *)
  • PARI
    a002068(n) = my(p=prime(n)); ((p-1)!+1)/p % p
    a197631(n) = my(p=prime(n), m=p-1); sum(k=1, m, k^m, -p-m!)/p^2 % p
    a(n) = a002068(n) + a197631(n)

Formula

a(n) = A002068(n) + A197631(n).

A283149 Largest k such that (p-1)! == -1 (mod p^k), where p = prime(n).

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1
Offset: 1

Views

Author

Felix Fröhlich, Mar 01 2017

Keywords

Comments

a(n) > 1 iff A002068(n) = 0, i.e., iff p is a Wilson prime (A007540).
Is a(n) < 3 for all n?

Crossrefs

Programs

  • Maple
    f:= proc(n) local p;
      p:= ithprime(n);
      padic:-ordp((p-1)!+1,p)
    end proc:
    map(f, [$1..200]); # Robert Israel, Apr 29 2021
  • Mathematica
    Table[With[{p = Prime@ n}, SelectFirst[Reverse@ Range@ 10, Mod[(p - 1)!, #] == # - 1 &[p^#] &]], {n, 105}] (* Michael De Vlieger, Aug 20 2017 *)
  • PARI
    a(n) = my(p=prime(n), k=1); while(Mod((p-1)!, p^k)==-1, k++); k-1

Extensions

More terms from Antti Karttunen, Aug 20 2017
Showing 1-7 of 7 results.