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.

A087242 Smallest prime number p such that n+p = q is also a prime, or 0 if no such prime number exists.

This page as a plain text file.
%I A087242 #19 Aug 02 2021 04:45:58
%S A087242 2,3,2,3,2,5,0,3,2,3,2,5,0,3,2,3,2,5,0,3,2,7,0,5,0,3,2,3,2,7,0,5,0,3,
%T A087242 2,5,0,3,2,3,2,5,0,3,2,7,0,5,0,3,2,7,0,5,0,3,2,3,2,7,0,5,0,3,2,5,0,3,
%U A087242 2,3,2,7,0,5,0,3,2,5,0,3,2,7,0,5,0,3,2,13,0,7,0,5,0,3,2,5,0,3,2,3,2,5,0,3,2
%N A087242 Smallest prime number p such that n+p = q is also a prime, or 0 if no such prime number exists.
%F A087242 a(n) = Min{x prime; n+x is prime}.
%e A087242 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+(odd prime) is a prime, thus no p prime exists such that 7+p is also a prime.
%e A087242 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.
%o A087242 (PARI) a(n) = {if (n % 2, if (isprime(n+2), p = 2, p = 0);, p = 2; while (!isprime(n+p), p = nextprime(p+1));); p;} \\ _Michel Marcus_, Dec 26 2013
%Y A087242 Cf. A087243, A174960.
%K A087242 nonn
%O A087242 1,1
%A A087242 _Labos Elemer_, Sep 04 2003