A031924 Primes followed by a gap of 6, i.e., next prime is p + 6.
23, 31, 47, 53, 61, 73, 83, 131, 151, 157, 167, 173, 233, 251, 257, 263, 271, 331, 353, 367, 373, 383, 433, 443, 503, 541, 557, 563, 571, 587, 593, 601, 607, 647, 653, 677, 727, 733, 751, 941, 947, 971, 977, 991, 1013, 1033, 1063, 1097, 1103, 1117, 1123, 1181
Offset: 1
Keywords
Examples
23 is a term as the next prime 29 = 23 + 6.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- OEIS wiki, Consecutive primes in arithmetic progression: CPAP with given gap, updated Jan. 2020
- Index entries for primes, gaps between
Programs
-
GAP
P:=Filtered([1..1200],IsPrime);; List(Filtered([1..Length(P)-1],i->P[i+1]-P[i]=6),k->P[k]); # Muniru A Asiru, Jan 30 2019
-
Magma
[p: p in PrimesUpTo(1200) | NextPrime(p)-p eq 6]; // Bruno Berselli, Apr 09 2013
-
Maple
A031924 := proc(n) option remember; if n = 1 then return 23; else p := nextprime(procname(n-1)) ; q := nextprime(p) ; while q-p <> 6 do p := q ; q := nextprime(p) ; end do: return p; end if; end proc: # R. J. Mathar, Jan 23 2013
-
Mathematica
Transpose[Select[Partition[Prime[Range[200]], 2, 1], Last[#] - First[#] == 6 &]][[1]] (* Bruno Berselli, Apr 09 2013 *)
-
PARI
is(n)=isprime(n)&&nextprime(n+1)-n==6 \\ Charles R Greathouse IV, Mar 21 2013
-
PARI
apply( A031924(n,p=2,show=0,g=6)={forprime(q=p+1,, p+g!=(p=q) || (show&&print1(p-g",")) || n-- || return(p-g))}, [1..99]) \\ Use nxt(p)=A031924(1,p) to get the term following p, use show=1 to print all a(1..n), g to select a different gap. - M. F. Hasler, Jan 02 2020
Extensions
New name from M. F. Hasler, Jan 02 2020
Comments