OFFSET
1,1
COMMENTS
A variant of A005846, A060566, A142719. All these aim at extending the series of prime values of Euler's famous prime-producing polynomial P(n)=n^2+n+41 (see references in A005846).
The present sequence is a simplification of an extended variant of A142719. By construction, all terms of the present sequence are prime, but in contrast to A005846, prime values of the polynomial remain at the "correct" position (a(n)=P(n)). The "substituted" values are easily recognized as they follow local maxima. Of course one could equally well insert a(n)=2 whenever P(n) is composite.
Note that the present sequence contains only primes. A different sequence, defined by "a(n)=f(n) if this is prime, a(n)=f(n-40) otherwise, where f(n)=n^2-n+41", does not always produce primes.
PROG
(PARI) a(n) = { while( !isprime( n^2-n+41 ), n-=40 ); n^2-n+41 }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
R. L. Bagula and M. F. Hasler (maximilian.hasler(AT)gmail.com), Jan 29 2009
STATUS
approved