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.

A249667 Numbers n such that the sum of n and the largest prime is prime, and the sum of n and the least prime>n is also prime.

This page as a plain text file.
%I A249667 #29 Feb 05 2025 01:50:19
%S A249667 6,24,30,36,50,54,78,84,114,132,144,156,174,210,220,252,294,300,306,
%T A249667 330,360,378,474,492,510,512,528,546,560,594,610,650,660,690,714,720,
%U A249667 762,780,800,804,810,816,870,912,996,1002,1068,1074,1104,1120,1170,1176,1190,1210,1236,1262
%N A249667 Numbers n such that the sum of n and the largest prime<n is prime, and the sum of n and the least prime>n is also prime.
%C A249667 This sequence is the intersection of A249624 and A249666.
%H A249667 Chai Wah Wu, <a href="/A249667/b249667.txt">Table of n, a(n) for n = 1..3410</a>
%e A249667 114 is in the sequence because the least prime>114 is 127 and 114+127=241 is prime; the largest prime<114 is 113 and 114+113=227 is prime. Also, 114 is in A249624 and A249666.
%t A249667 Select[Range[1500],AllTrue[#+{NextPrime[#],NextPrime[#,-1]},PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Mar 09 2016 *)
%o A249667 (PARI) {for(i=3,2*10^3,k=i+nextprime(i+1);q=i+precprime(i-1);if(isprime(k)&&isprime(q),print1(i,", ")))}
%o A249667 (Python)
%o A249667 from gmpy2 import is_prime, next_prime
%o A249667 A249667_list, p = [], 2
%o A249667 for _ in range(10**4):
%o A249667     q = next_prime(p)
%o A249667     n1 = 2*p+1
%o A249667     n2 = p+q+1
%o A249667     while n1 < p+q:
%o A249667         if is_prime(n1) and is_prime(n2):
%o A249667             A249667_list.append(int(n1-p))
%o A249667         n1 += 2
%o A249667         n2 += 2
%o A249667     p = q # _Chai Wah Wu_, Dec 06 2014
%Y A249667 Cf. A249624, A249666, A249676.
%K A249667 nonn
%O A249667 1,1
%A A249667 _Antonio Roldán_, Dec 03 2014