login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
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

LINKS

Iain Fox, Table of n, a(n) for n = 1..2000

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 xrange(2, 20001):

    for k in xrange(n, -1, -1):

        if isprime(1 + k*p):

            A+=[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

Cf. A036012, A290639.

Sequence in context: A099072 A257241 A239964 * A106464 A093003 A118096

Adjacent sequences:  A290582 A290583 A290584 * A290586 A290587 A290588

KEYWORD

nonn

AUTHOR

Thomas Ordowski, Aug 07 2017

EXTENSIONS

More terms from Robert Israel, Aug 07 2017

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 21 10:30 EDT 2019. Contains 322328 sequences. (Running on oeis4.)