OFFSET
1,1
COMMENTS
The distinction between a prime that is a term and the primes p and q is by definition only, and values in both sets may intersect and can be used for either role. Any p and q determined by the rule, cannot however be used more than once for that purpose.
In the situation where a term has more than one possible representation, all possible p and q are eliminated from further consideration. See a(8) in the Examples.
Will there be ever increasing runs of missing primes from this sequence?
Will there be ever increasing numbers of multiple (p, q) value pairs corresponding to some terms?
LINKS
David A. Corneth, PARI program
EXAMPLE
Trying to find the first suitable term, neither the double of 2 nor that of 3, that is, 4 and 6, can be partitioned into two distinct primes p and q, so 2 and 3 cannot be the defined averages of any p and q for the sequence.
So moving onto 5 as a candidate for the first term, we successfully find a(1) with it.
a(1) = 5 as (3 + 7)/2 = 5 with p = 3 and q = 7, these primes satisfy the condition. No other distinct p and q add up to 10 so as 5 to become also their average.
In the next step, a new term and the double of its value is sought after, and 2*7 = 14 is tried. It can be partitioned into 3 and 11, both primes, but 3 was already used for a(1) in the role of p. 5 + 9 is not good as 9 is not a prime. Therefore we reject 7 as a candidate term, and move on.
a(2) = 11 is successfully found, whose double is 22. As 22 = 5 + 17, both unused primes for the role of p and q, whose average is 11, and so this new term is valid. Note that 5 was already used as a term, but not as p or q before. Here, a(2) does not yield further p and q by the rule, either.
With subsequent primes tried we find at times no result, at other times further terms are produced to fill in the sequence.
a(8) = 67 is the first term that produces two distinct p's and q's, which it is a common average of: (37 + 97)/2 = (31 + 103)/2 = 67. After this step, none of 31, 37, 97, or 103 can be used for p or q in future terms.
PROG
(PARI) lista(nn) = my(va = List(), vp = List()); forprime(p=2, nn, my(list=List()); forprime(q=1, 2*p-1, if (isprime(2*p-q) && (q!=p) && (q<2*p-q) && !vecsearch(va, q) && !vecsearch(va, 2*p-q), listput(va, q); listput(va, 2*p-q); listsort(va); listput(vp, p); ); ); ); vecsort(Vec(vp), , 8); \\ Michel Marcus, Aug 24 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Tamas Sandor Nagy, Aug 20 2025
STATUS
approved
