

A237196


a(n) = index j of the first composite number in the sequence prime(1)*...*prime(n1)*prime(n+1)*...*prime(j) + prime(n).


1



4, 5, 7, 1, 4, 1, 5, 1, 1, 2, 1, 1, 9, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 6, 1, 8, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 3, 1, 2, 1, 1, 1, 4, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

This is based on a modification of Euclid's proof of the infinitude of primes.


LINKS

Table of n, a(n) for n=1..87.
Alexander Bogomolny, Infinitely many proofs that there are infinitely many primes
Alexander Bogomolny, Python program
Des MacHale, Infinitely many proofs that there are infinitely many primes, Math. Gazette, 97 (No. 540, 2013), 495498.


EXAMPLE

This is a modification of Euclid's proof of the infinitude of primes. Instead of 1, add a prime but exclude it from the product. For example, primes: 3+2, 3*5+2, 3*5*7+2, but 3*5*7*11+2 is composite. This is the 4 at the beginning of the sequence.


PROG

(Python) see Python program link
(PARI) val(j, n) = {p = prod(k=1, j, prime(k)); if (n<=j, p = p/prime(n)); p + prime(n); }
a(n) = {j = 1; prev = 0; nb = 1; while (! isprime(newv = val(j, n)), if (newv != prev, nb++); j++; prev = newv; ); if (n==1, nb1, nb); } \\ Michel Marcus, Apr 15 2014


CROSSREFS

Sequence in context: A298982 A112247 A319260 * A322711 A057055 A177883
Adjacent sequences: A237193 A237194 A237195 * A237197 A237198 A237199


KEYWORD

nonn


AUTHOR

Alexander Bogomolny, Feb 04 2014


EXTENSIONS

New name, data corrected and extended by Michel Marcus, Apr 15 2014


STATUS

approved



