login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A290585
a(n) is the largest number <= n such that 1 + a(1)*a(2)*...*a(n) is prime.
2
1, 2, 3, 3, 4, 6, 6, 4, 7, 7, 3, 10, 13, 12, 10, 9, 13, 14, 15, 16, 13, 21, 22, 11, 25, 26, 27, 17, 29, 23, 7, 11, 30, 24, 34, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45, 39, 23, 48, 32, 25, 44, 49, 53, 31, 1, 1, 1, 1, 59, 46, 53, 55, 62, 40, 62, 59, 46, 41, 9, 62, 59, 64, 1, 1, 1, 1, 1, 1, 1, 80, 57, 78, 80, 1, 85
OFFSET
1,2
COMMENTS
a(n) = n for n = 1, 2, 3, 6, 13, 25, 26, 27, 29, 45, 48, 53, 59, 80, 85, ...
If a(n) = 1, then the next entry > 1 is a(m) = m for the least m > n such that 1 + m * Product_{j=1..n-1} a_j is prime. By Dirichlet's theorem such m exists. - Robert Israel, Aug 07 2017
MAPLE
A[1]:= 1: P:= 1:
for n from 2 to 200 do
for k from n to 0 by -1 do
if isprime(1+k*P) then
A[n]:= k;
P:= P*k;
break
fi
od;
od:
seq(A[i], i=1..200); # Robert Israel, Aug 07 2017
MATHEMATICA
p = 1; Table[t = SelectFirst[Range[n, 1, -1], PrimeQ[1 + p #] &]; p *= t; t, {n, 85}] (* Giovanni Resta, Aug 08 2017 *)
PROG
(Python)
from sympy import isprime
A=[0, 1]
p=1
for n in range(2, 201):
for k in range(n, -1, -1):
if isprime(1 + k*p):
A.append(k)
p*=k
break
print(A[1:]) # Indranil Ghosh, Aug 10 2017
(PARI) first(n) = { my(i = 1, res = vector(n)); res[1]=1; for(x=2, n, forstep(k=x, 0, -1, if(ispseudoprime(1+k*i), res[x]=k; i*=k; break()))); res; } \\ Iain Fox, Nov 15 2017
CROSSREFS
Sequence in context: A099072 A257241 A239964 * A106464 A093003 A348540
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Aug 07 2017
EXTENSIONS
More terms from Robert Israel, Aug 07 2017
STATUS
approved