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.

Previous Showing 11-20 of 41 results. Next

A083534 First difference sequence of A007617. Difference between consecutive values not being in the range of phi (A000010).

Original entry on oeis.org

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

Views

Author

Labos Elemer, May 20 2003

Keywords

Comments

a(n) is either 2 or 1 since odd numbers are in A007619.
If a(n) = 1 then A007619(n+1) is an even number not in the range of phi.

Examples

			{11,13,14,15,17} are not in the range of phi and the corresponding differences are {2,1,1,2}.
		

Crossrefs

Programs

  • Haskell
    a083534 n = a083534_list !! (n-1)
    a083534_list = zipWith (-) (tail a007617_list) a007617_list
    -- Reinhard Zumkeller, Nov 26 2015
    
  • Mathematica
    t0[x_] := Table[j, {j, 1, x}]; t=Table[EulerPhi[w], {w, 1, 10000}]; u=Union[%]; c=Complement[t0[10000], u]; Delete[c-RotateRight[c], 1]
  • PARI
    list(lim) = {my(k1 = 3, k2 = 3); while(k1 < lim, until(!istotient(k2), k2++); print1(k2 - k1, ", "); k1 = k2); } \\ Amiram Eldar, Feb 22 2025

Formula

a(n) = A007617(n+1) - A007617(n).

A157249 Generalized Wilson quotients (or Wilson quotients for composite moduli).

Original entry on oeis.org

2, 1, 1, 1, 5, 1, 103, 13, 249, 19, 329891, 32, 36846277, 1379, 59793, 126689, 1230752346353, 4727, 336967037143579, 436486, 2252263619, 56815333, 48869596859895986087, 1549256, 1654529071288638505, 23390099351, 56463097772562963, 51860555558, 10513391193507374500051862069
Offset: 1

Views

Author

Jonathan Sondow and Wadim Zudilin, Feb 27 2009

Keywords

Comments

By Wilson's Theorem, for prime p the Wilson quotient ((p-1)!+1)/p is an integer A007619. By Gauss's extension (see Dickson p. 65), the generalized Wilson quotient (P(n)+e(n))/n is an integer, where P(n) = n-phi-torial A001783 and e(n) = +1 or -1 according as n does or does not have a primitive root (see A033948).
For additional references and links, see A007540.

Examples

			P(8) = 3*5*7 = 105 and e(8) = -1, so a(8) = (105-1)/8 = 13.
		

References

  • L. E. Dickson, History of the Theory of Numbers, vol. 1, Divisibility and Primality, Chelsea, New York, 1966.

Crossrefs

Cf. Wilson quotient A007619, Wilson prime A007540, Wilson number A157250, n-phi-torial A001783, numbers having a primitive root A033948.
Cf. A317507.

Programs

  • Maple
    a := proc(n) local A001783,e,i;
    A001783 := proc(n) local i; mul(i,i=select(k->igcd(k,n)=1,[$1..n]))end;
    e := proc(n) local p,r,P; if n=1 or n=2 or n=4 then RETURN(1) fi;
    P := select(isprime,[$3..n]); for p in P do r := p;
    while r <= n do if n = r or n = 2*r then RETURN(1) fi;
    r := r*p; od od; -1 end; (A001783(n)+e(n))/n end:
    # Peter Luschny, Jul 19 2009
  • Mathematica
    p[n_] := Times @@ Select[ Range[n], CoprimeQ[n, #] & ]; e[1 | 2 | 4] = 1; e[n_] := (fi = FactorInteger[n]; If[MatchQ[fi, {{(p_)?OddQ, }} | {{2, 1}, {, }}], 1, -1]); a[n] := (p[n] + e[n])/n; Table[a[n], {n, 1, 25}] (* Jean-François Alcover, Sep 28 2011 *)

Formula

a(n) = (P(n)+e(n))/n, with P(n) = n-phi-torial = A001783(n) and e(n) = +1 if n = 1, 2, 4, p^k or 2p^k, where p is an odd prime and k > 0, and e(n) = -1 otherwise.

A197630 Lerch quotients of odd primes: ((Sum_{k=1..p-1} q_p(k)) - w_p)/p, where q_p(k) = (k^(p-1)-1)/p is a Fermat quotient, w_p = ((p-1)!+1)/p is a Wilson quotient, and p is the n-th prime, with n > 1.

Original entry on oeis.org

0, 13, 1356, 123229034, 79417031713, 97237045496594199, 166710337513971577670, 993090310179794898808058068, 60995221345838813484944512721637147449, 332049278209768881045237587717723153006704, 120846039713576242385812868532189241842793944235993733
Offset: 2

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Comments

Lerch proved that the Lerch quotient of any odd prime is an integer.
Is 13 the only Lerch quotient that is itself prime?
No other primes below 300,000 digits. - Charles R Greathouse IV, Nov 16 2011
Proof that a(n) is an integer for n >= 2: Note that ((p-1)!)^(p-1) = Product_{i=1..p-1} (1+i^(p-1)-1) == 1+Sum_{i=1..p-1} (i^(p-1)-1) (mod p^2). Write (p-1)! = kp-1, then ((p-1)!)^(p-1) == 1-(p-1)*kp == kp+1 == (p-1)!+2 (mod p^2). This gives Sum_{i=1..p-1} (i^(p-1)-1) == (p-1)!+1 (mod p^2), or Sum_{i=1..p-1} (i^(p-1)-1)/p == ((p-1)!+1)/p (mod p). - Jianing Song, Oct 15 2019

Examples

			a(3) = 13 because the 3rd prime is 5 and ((Sum_{k=1..4} q_5(k)) - w_5)/5 = (0 + 3 + 16 + 51 - 5)/5 = 13.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = Prime[n]}, (Sum[(k^(p - 1) - 1)/p, {k, p - 1}] - ((p - 1)! + 1)/p)/p]; Array[f, 12, 2] (* Robert G. Wilson v, Dec 01 2016 *)
  • PARI
    a(n)=my(p=prime(n),m=p-1); sum(k=1,m, k^m,-p-m!)/p^2 \\ Charles R Greathouse IV, Oct 18 2011

Formula

a(n) = ((Sum_{k=1..p-1} k^(p-1)) - p - (p-1)!)/p^2, where p is the n-th prime and n >= 2.

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

A197633 Fermat-Wilson quotients of non-Wilson primes: q_p(w_p), where q_p(k) = (k^(p-1)-1)/p is a Fermat quotient, w_p = ((p-1)!+1)/p is a Wilson quotient, and p is a non-Wilson prime.

Original entry on oeis.org

0, 0, 170578899504, 1387752405580695978098914368989316131852701063520729400
Offset: 1

Views

Author

Jonathan Sondow, Oct 16 2011

Keywords

Comments

A Wilson prime is a prime p that divides its Wilson quotient w_p (see A007619). The known Wilson primes are 5, 13, 563 (see A007540).
If p is a non-Wilson prime (see A197636), then p does not divide w_p, and so by Fermat's little theorem the Fermat quotient q_p(w_p) is an integer.
The next term is the Fermat-Wilson quotient of 17, which has 193 digits.
The Fermat-Wilson quotient of 14771 (see A197635) has over 800 million digits.
The GCD of all Fermat-Wilson quotients is 24. In particular, q_p(w_p) is never prime.

Examples

			The 3rd non-Wilson prime is 7, so a(3) = (((6!+1)/7)^6-1)/7 = 170578899504.
		

Crossrefs

Programs

  • Mathematica
    nmax=4; nonWilsonQ[p_] := Mod[((p-1)!+1)/p ,p] != 0; A197636 = Select[ Prime[ Range[nmax+2]], nonWilsonQ]; a[n_] := With[{p=A197636[[n]]}, ((((p-1)!+1)/p)^(p-1)-1)/p]; Table[ a[n], {n, 1, nmax}] (* Jean-François Alcover, Dec 14 2011 *)

Formula

a(n) = ((((p-1)!+1)/p)^(p-1)-1)/p, where p = A197636(n).

A239502 (Round(q^prime(n)) - 1)/prime(n), where q is the tribonacci constant (A058265).

Original entry on oeis.org

4, 10, 74, 212, 1856, 5618, 53114, 1630932, 5161442, 167427844, 1729192432, 5577731626, 58401766802, 2005139696964, 69737304018266, 228184540445268, 8043367476888770, 86866463049858250, 285815985033409648, 10225367934387562098, 111384745483589787826
Offset: 3

Views

Author

Keywords

Comments

For n>=3, round(q^prime(n)) == 1 (mod 2*prime(n)). Proof in Shevelev link. In particular, all terms are even.

Examples

			For n=3, q^5 = 21.049..., so a(3) = (21 - 1)/5 = 4.
		

Crossrefs

A122696 Primes of the form ((k-1)! + 1)/k.

Original entry on oeis.org

2, 5, 103, 329891, 10513391193507374500051862069
Offset: 1

Views

Author

Alexander Adamchuk, Sep 22 2006

Keywords

Comments

A163212, Wilson quotients (A007619: ((p-1)!+1)/p) which are primes, is a subsequence. Corresponding numbers n such that ((n-1)! + 1)/n is prime are listed in A050299 = {1, 5, 7, 11, 29, 773, 1321, 2621, ...}. a(6) has 1893 digits. a(7) has 3545 digits. a(8) has 7817 digits.
Except for a(1) = 2, same as A163212. - Jonathan Sondow, May 20 2013

Crossrefs

A050299 is the main entry for this sequence.

Programs

  • Mathematica
    Select[Table[((k-1)!+1)/k,{k,30}],PrimeQ] (* James C. McMahon, Nov 09 2024 *)
  • PARI
    is(n)=isprime(((n-1)!+1)/n) \\ Anders Hellström, Nov 22 2015 \\ This program actually produces A050299 - Michel Marcus, Aug 02 2016
    
  • PARI
    for(n=1, 1e2, if(((n-1)!+1)%n==0 && isprime(k=((n-1)!+1)/n), print1(k, ", "))) \\ Altug Alkan, Nov 22 2015

Formula

a(n) = A163212(n-1) = ((A050299(n)-1)! + 1)/A050299(n). - Jonathan Sondow, May 19 2013

Extensions

The next term is too large to include.
a(4) and first comment corrected by Gionata Neri, Aug 02 2016

A157250 Wilson numbers: k such that the generalized Wilson quotient A157249(k) is divisible by k.

Original entry on oeis.org

1, 5, 13, 563, 5971, 558771, 1964215, 8121909, 12326713, 23025711, 26921605, 341569806, 399292158
Offset: 1

Views

Author

Jonathan Sondow and Wadim Zudilin, Feb 27 2009

Keywords

Comments

A prime p is a Wilson prime if p divides its Wilson quotient A007619. A number n is a Wilson number if n divides its generalized Wilson quotient A157249.
The sequence contains all Wilson numbers <= 5 x 10^8. Heuristics suggest that #(Wilson numbers < N) is about (6/pi^2) log N, for large N.
A Wilson number is prime if and only if it is a Wilson prime A007540. Only three are known: 5, 13, 563.
The first composite Wilson number 5971 was discovered by Kloss, the others by Agoh, Dilcher, and Skula. Every known composite Wilson number n has at least two odd prime factors, so e(n) = -1.
For additional references and links, see A007540.

Examples

			A157249(13) = (A001783(13) + e(13))/13 = ((13-1)! + 1)/13 = 479001601/13 = 36846277 == 0 mod 13, so 13 is a member. A001783(5971) + e(5971) = A001783(5971) - 1 == 0 mod 5971^2, so 5971 is a member. But A157249(8) = (A001783(8) + e(8))/8 = (3*5*7 - 1)/8 = 13 ==/== 0 mod 8, so 8 is not a member.
		

References

  • L. E. Dickson, History of the Theory of Numbers, vol. 1, Divisibility and Primality, Chelsea, New York, 1966, p. 65.

Crossrefs

Cf. Wilson quotient A007619, Wilson prime A007540, generalized Wilson quotient A157249, n-phi-torial A001783, numbers having a primitive root A033948.

Programs

  • Mathematica
    f[n_] := Times @@ Select[Range[n], CoprimeQ[n, #]&];
    e[1|2|4] = 1; e[n_] := If[MatchQ[FactorInteger[n], {{?OddQ, }} | {{2, 1}, {, }}], 1, -1];
    WilsonQ[n_] := IntegerQ[(f[n] + e[n])/n^2];
    Reap[For[k = 1, k < 10^7, k++, If[WilsonQ[k], Print[k]; Sow[k]]]][[2, 1]] (* Jean-François Alcover, Dec 11 2018 *)

Formula

A157249(n) == 0 mod n.
A001783(n) + e(n) == 0 mod n^2, where e(n) = +1 or -1 according as n does or does not have a primitive root.

A239544 (Round(c^prime(n)) - 1)/prime(n), where c is the tetranacci constant (A086088).

Original entry on oeis.org

14, 124, 390, 4118, 13690, 156122, 6351030, 22074820, 948652694, 11818395344, 41868809842, 528803858638, 24052859078262, 1108257471317098, 3982717894786008, 185987895674303758, 2422894681885464596, 8755616404517667662, 414985190213435939298
Offset: 4

Views

Author

Keywords

Comments

For n>=4, round(c^prime(n)) == 1 (mod 2*prime(n)). Proof in Shevelev link. In particular, all terms are even.

Crossrefs

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
Previous Showing 11-20 of 41 results. Next