The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A284278 a(1)=2; for n >= 1, if n+2 is prime then a(2*n+1) = 3*n + 2 and a(2*n) = n + 2, otherwise all terms are 2. 0
 2, 3, 5, 4, 2, 5, 9, 6, 2, 7, 13, 8, 2, 9, 2, 10, 2, 11, 21, 12, 2, 13, 25, 14, 2, 15, 2, 16, 2, 17, 33, 18, 2, 19, 37, 20, 2, 21, 2, 22, 2, 23, 45, 24, 2, 25, 2, 26, 2, 27, 2, 28, 2, 29, 57, 30, 2, 31, 61, 32, 2, 33, 2, 34, 2, 35, 2, 36, 2, 37, 73, 38, 2, 39 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,1 COMMENTS The sequence is motivated by A284172, by the message from B. Jubin dated Mar 23 2017 and by the classic open problem of showing that there are infinitely many primes p for which 2*p-1 is also prime. If there were only finitely many such primes, then there would be a place where this sequence is generated by the same rule as A284172. The sequence of the first differences begins 1, 2, -1, -2, 3, 4, -3, -4, 5, 6, -5, -6, 7, -7, 8, -8, 9, 10, -9, -10, 11, 12, -11, -12, 13, -13, 14, -14, 15, 16, -15, -16, 17, 18, ... From the definition it easily follows that, for a positive x, the sequence contains roughly equal numbers of prime and composite terms <= x. A conditional property: if there is a maximal prime P such that 2*P-1 is also prime, then for n > P, every pair (a(2*n), a(2*n+1)) contains one prime and one composite. Indeed, if n+2 is prime, then a(2*n) = n + 2 is prime, while a(2*n+1) = 2*n + 3 = 2*(n+2) - 1 is composite; if n+2 is composite, then a(2*n) = n + 2 is composite, while a(2*n+1) = 2 is prime. - Vladimir Shevelev, Mar 26 2017 LINKS EXAMPLE For n=19, a(38) = a(2*19) = 19+2 = 21, a(39) = a(2*19+1) = 2, the latter since 19+2 is not prime; for n=21, a(42) = a(2*21) = 21+2 = 23, a(43) = a(2*21+1) = 2*21+3 = 45 since 21+2 is prime. MATHEMATICA a:=2; a[n_?EvenQ]:=n/2+2; a[n_?OddQ]:=If[PrimeQ[(n+1)/2+1], n+2, 2]; Map[a, Range] (* Peter J. C. Moses, Mar 24 2017 *) PROG (PARI) a(n) = if(n<2, 2, if(n%2, if(isprime((n + 1)/2 + 1), n + 2, 2), (n/2 + 2))); \\ Indranil Ghosh, Mar 25 2017 CROSSREFS Cf. A284172. Sequence in context: A280319 A021981 A281941 * A330080 A068508 A137403 Adjacent sequences:  A284275 A284276 A284277 * A284279 A284280 A284281 KEYWORD nonn AUTHOR Vladimir Shevelev, Mar 24 2017 EXTENSIONS More terms from Peter J. C. Moses, Mar 24 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.

Last modified July 25 03:53 EDT 2021. Contains 346283 sequences. (Running on oeis4.)