# OEIS conventions - twin prime gaps

Maximilian Hasler maximilian.hasler at gmail.com
Thu May 24 17:20:16 CEST 2007

```I suppose this might also be due to changed conventions:
The comments and examples in sequences
http://www.research.att.com/~njas/sequences/?q=id%3AA113274%7Cid%3AA113275
refer to a(0),a(1)... instead of a(1),a(2)....

Also, I think the example to A113275 is incorrect or at least misleading:

%e A113275 The smallest twin prime pair is 3,5, then 5,7 so a(0)=3 and
a(1)=5; the following pair is 11,13 so a(2)=5 because 11-5=6>5-3=2;
the following pair is 17,19: since 17-11=6=11-5 nothing happens; the
following pair is 29,31 so a(3)=17 because 29-17=12>11-5=6

As I understand it, a(1) (rather a(2), i.e. the second term of
A113275) equals 5
NOT because (5,7) is the following pair,
BUT because (11,13) is the pair following (5,7) and establishing a new
record gap 11-5 = 6 > 2 = 5-3 (= first gap between twin prime PAIRS
(3,5) and (5,7)).
(If the pair after (5,7) would have been (7,9), then 5 would not
figure in the list, as I understand it. Only after having found the
next pair establishing a new record gap, one can know if a "lesser
twin" is in the sequence.)

Then, the example mentions a second occurence of 5
(a(1)=5...a(2)=5...) which does not correspond to the sequence,
%S A113275 3,5,17,41,71,311,347,659,2381,5879,13397,18539...

So the correction I suggest would be:
%e A113275 The smallest twin prime pair is 3,5, then 5,7 so a(1)=3;
the following pair is 11,13 so a(2)=5 because 11-5=6>5-3=2;...

I send a copy to seqfan since I'm not completely sure of what should be written,
partially because the definition ("...gap before...") *might* allow a
different interpretation. Maybe somebody can better elucidate.

M.H.
PS: at the end of the mail I include PARI code corresponding to the
definition as I understand it. It prints out the lesser of the pair
preceding the gap, when a new record gap is found.

%I A113274
%N A113274 Record gaps between twin primes.
%C A113274 a(n) mod 6 = 0 for each n>0.
%e A113274 The first twin primes are 3,5 and 5,7 so a(0)=5-3=2. The following
%O A113274 1,1
%A A113274 Bernardo Boncompagni (redgolpe(AT)redgolpe.com), Oct 21 2005
%E A113274 More terms from Robert G. Wilson v (rgwv(at)rgwv.com), Oct 22 2005

%N A113275 Lesser of twin primes for which the gap before the
following twin primes is a record.
%e A113275 The smallest twin prime pair is 3,5, then 5,7 so a(0)=3 and
a(1)=5; the following pair is 11,13 so a(2)=5 because 11-5=6>5-3=2;
the following pair is 17,19: since 17-11=6=11-5 nothing happens; the
following pair is 29,31 so a(3)=17 because 29-17=12>11-5=6
%O A113275 1,1
%A A113275 Bernardo Boncompagni (redgolpe(AT)redgolpe.com), Oct 21 2005
%E A113275 a(22)-a(30) from Robert G. Wilson v (rgwv(at)rgwv.com), Oct 22 2005

(PARI)
{A113274and5()=local(rec,cnt1,cnt=1,lp /*last prime*/, ltp /*last
twin(upper)*/, p=5);
while( 50>cnt1,    until( rec < p-ltp,      ltp=p;
/* skip to next twin: */ until((p=nextprime(1+lp=p))-lp==2,);
cnt++;
);    /* found new record */ cnt1++;
/*write("b113274.txt",cnt1," ",rec=p-ltp);*/
print([cnt1, rec=p-ltp, cnt, ltp-2]);  )}

```