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.
%I A375543 #62 Jul 27 2025 11:16:11 %S A375543 2,3,7,43,13,139,547,607,1033,181,1987,73,2287,29881,13999,17881, %T A375543 31051,52387,67003,74203,128551,352867,635263,74587,1286773,2271427, %U A375543 27061,164299,20929,1171,298483,1679143,3229081,3263443,120823,447841,2408563,333457,30241,4219 %N A375543 Sylvester primes. Yet another proof of the infinity of primes. %C A375543 Sylvester's sequence can be defined recursively S(n) = S(n-1)*(S(n-1) + 1) for n >= 1 starting S(0) = 1. (A000058(n) = S(n) + 1.) %C A375543 Since S(n) and S(n) + 1 have no common divisors, it follows that S(n) has at least one more prime factor than S(n-1), and thus by induction, S(n) has at least n distinct prime factors. This simple and constructive form of Euclid's proof of the infinity of primes was formulated by Filip Saidak (see links). %C A375543 To generate the sequence, select the smallest unchosen prime factor from all prime factors of S(0), S(1), ..., S(n-1). We call the infinite sequence constructed this way the 'Sylvester primes'. The terms, when ordered by size, can be found in A007996; any prime not a Sylvester prime can be located in A096264. %C A375543 As a procedure, the sequence can hardly be described more clearly than in the Maple program below. Compared to other variants (for example A126263), it has the advantage that the primes generated start relatively small. %H A375543 Jens Kruse Andersen, <a href="http://primerecords.dk/sylvester-factors.htm">Factorization of Sylvester's sequence</a>. %H A375543 Chris Caldwell, <a href="https://t5k.org/notes/proofs/infinite/Saidak.html">Filip Saidak's Proof</a>, PrimePages. %H A375543 Filip Saidak, <a href="https://doi.org/10.2307/27642094">A New Proof of Euclid's Theorem</a>, Amer. Math. Monthly, Vol. 113, No. 10 (Dec., 2006), pp. 937-938. %e A375543 The generation of the sequence starts: %e A375543 n selected factors of S(i), i<n a(n) %e A375543 [1] {} {2} -> 2, %e A375543 [2] {2} {2, 3} -> 3, %e A375543 [3] {2, 3} {2, 3, 7} -> 7, %e A375543 [4] {2, 3, 7} {2, 3, 7, 43} -> 43, %e A375543 [5] {2, 3, 7, 43} {2, 3, 7, 13, 43, 139} -> 13. %p A375543 fact := n -> NumberTheory:-PrimeFactors(n): %p A375543 SylvesterPrimes := proc(len) local p, d, w, n; %p A375543 p := 1; d := {}; w := {}; %p A375543 for n from 1 to len do %p A375543 p := p*(p + 1); %p A375543 d := fact(p) minus w; %p A375543 w := w union {min(d)}; %p A375543 od end: %p A375543 SylvesterPrimes(8); %p A375543 isSylvesterPrime := proc(p) local s, M; %p A375543 M := NULL: s := 2: %p A375543 while not member(s, [M]) do %p A375543 M := M, s; %p A375543 s := (s^2 + s) mod p; %p A375543 if s = 0 then return true fi; %p A375543 od: false end: %t A375543 Module[{nmax = 20, a = {}, p = 1, f}, Do[p *= p + 1; f = 2; While[MemberQ[a,f] || !Divisible[p, f], f = NextPrime[f]]; AppendTo[a, f], nmax]; a] (* _Paolo Xausa_, Sep 03 2024 *) %o A375543 (Python) %o A375543 from sympy import sieve %o A375543 from itertools import count, islice %o A375543 def smallest_new_primefactor(n, pf): %o A375543 return next(pi for i in count(1) if (pi:=sieve[i]) not in pf and n%pi==0) %o A375543 def agen(): # generator of terms %o A375543 p, d, w, pf = 1, set(), set(), set() %o A375543 while True: %o A375543 p = p*(p + 1) %o A375543 m = smallest_new_primefactor(p, w) %o A375543 w |= {m} %o A375543 yield m %o A375543 print(list(islice(agen(), 20))) %o A375543 # _Michael S. Branicky_, Sep 02 2024 after _Peter Luschny_ %o A375543 (SageMath) # Returns the first 24 terms in less than 60 seconds. %o A375543 def SylvesterPrimes(len: int) -> list[int]: %o A375543 M: list[int] = [] %o A375543 p = q = 1 %o A375543 for n in range(1, len + 1): %o A375543 p = p * (p + 1) %o A375543 pq = p // q %o A375543 for s in Primes(): %o A375543 if pq % s == 0 and not s in M: %o A375543 M.append(s) %o A375543 q = q * s %o A375543 print(n, s) %o A375543 break %o A375543 return M %o A375543 SylvesterPrimes(24) # _Peter Luschny_, Sep 05 2024 %Y A375543 Cf. A000040, A000058, A007018, A007996, A014546, A091336, A096264, A375545 (indices in P). %Y A375543 Variants: A126263, A367020. %K A375543 nonn %O A375543 1,1 %A A375543 _Peter Luschny_, Sep 02 2024 %E A375543 a(21)-a(31) from _Michael S. Branicky_, Sep 03 2024 %E A375543 a(32) from _Paolo Xausa_, Sep 04 2024 %E A375543 a(33)-a(36) from _Peter Luschny_, Sep 05 2024 %E A375543 a(37)-a(40) from _Jinyuan Wang_, Jul 25 2025