cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A087243 a(n) = n + A087242(n) or a(n)=0 if A087242(n)=0; the primes arising as n + A087242(n).

This page as a plain text file.
%I A087243 #25 Feb 23 2019 04:28:53
%S A087243 3,5,5,7,7,11,0,11,11,13,13,17,0,17,17,19,19,23,0,23,23,29,0,29,0,29,
%T A087243 29,31,31,37,0,37,0,37,37,41,0,41,41,43,43,47,0,47,47,53,0,53,0,53,53,
%U A087243 59,0,59,0,59,59,61,61,67,0,67,0,67,67,71,0,71,71,73,73,79,0,79,0,79,79,83,0
%N A087243 a(n) = n + A087242(n) or a(n)=0 if A087242(n)=0; the primes arising as n + A087242(n).
%C A087243 If n is odd, a(n) is either n+2 (if n+2 is prime) or 0; if n is even, a(n) is the least prime p such that p-n is prime. Polignac's conjecture implies that such a prime exists.  - _Robert Israel_, Sep 29 2014
%F A087243 a(n) = n+Min{x prime; n+x is prime} or a(n)=0 if Min{} does not exist.
%e A087243 a(n)=0, i.e., no solution exists if n is a special prime, namely n is not a lesser twin prime; e.g., if n=7, then neither 7+2=9 nor 7+(oddprime) is a prime, thus no p prime exists such that 7+p is also a prime.
%e A087243 If n is a lesser twin prime then a(n)=2 is a solution because n+a(n) = n+2 = greater twin prime satisfying the condition.
%p A087243 N:= 1000: # to get the first N terms
%p A087243 nToDo:= floor(N/2): OddPrimes[1]:= 3: A[1]:= 3:
%p A087243 for i from 1 to floor(N/2) do A[2*i+1]:= 0 od:
%p A087243 for j from 2 while nToDo > 0 do
%p A087243    OddPrimes[j]:= nextprime(OddPrimes[j-1]);
%p A087243    A[OddPrimes[j]-2]:= OddPrimes[j];
%p A087243    for i from 1 to j-1 do
%p A087243       d:= OddPrimes[j] - OddPrimes[i];
%p A087243       if d <= N and not assigned(A[d]) then
%p A087243          A[d]:= OddPrimes[j];
%p A087243          nToDo:= nToDo-1;
%p A087243       fi
%p A087243     od
%p A087243 od:
%p A087243 seq(A[j], j=1..N); # _Robert Israel_, Sep 29 2014
%o A087243 (PARI) a(n) = {if (n % 2, if (isprime(n+2), p = 2, p = 0);, p = 2; while (!isprime(n+p), p = nextprime(p+1));); if (p, n + p, 0);} \\ _Michel Marcus_, Dec 26 2013
%Y A087243 Cf. A087242.
%K A087243 nonn
%O A087243 1,1
%A A087243 _Labos Elemer_, Sep 04 2003
%E A087243 Some corrections by _Michel Marcus_, Dec 26 2013