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.

A347008 Numbers that can be written in exactly two ways as p*q+p+q where p and q are primes with p < q.

This page as a plain text file.
%I A347008 #13 Aug 10 2021 22:01:16
%S A347008 23,47,119,167,179,323,407,419,527,587,639,647,879,935,1043,1103,1119,
%T A347008 1139,1215,1223,1247,1271,1331,1367,1403,1455,1595,1599,1631,1691,
%U A347008 1775,1791,1859,1895,1931,1943,1959,1967,1979,2099,2111,2175,2183,2219,2231,2435,2471,2483,2495,2543,2559,2603
%N A347008 Numbers that can be written in exactly two ways as p*q+p+q where p and q are primes with p < q.
%H A347008 Robert Israel, <a href="/A347008/b347008.txt">Table of n, a(n) for n = 1..5000</a>
%e A347008 a(3) = 119 is a term because 119 = 5*19+5+19 = 3*29+3+29 are the two ways to produce 119 = p*q+p+q with primes p < q.
%p A347008 N:= 10000: # to produce terms <= N
%p A347008 R:= Vector(N):
%p A347008 P:= select(isprime, [2,seq(i,i=3..N/3,2)]):
%p A347008 for i from 1 to nops(P) do
%p A347008   for j from 1 to i-1 do
%p A347008    v:=P[i]*P[j]+P[i]+P[j];
%p A347008    if v <= N then R[v]:= R[v]+1 fi
%p A347008 od od:
%p A347008 select(t -> R[t]=2, [$1..N]);
%o A347008 (Python)
%o A347008 from sympy import primerange
%o A347008 from collections import Counter
%o A347008 def aupto(limit):
%o A347008     primes = list(primerange(2, limit//3+1))
%o A347008     nums = [p*q+p+q for i, p in enumerate(primes) for q in primes[i+1:]]
%o A347008     counts = Counter([k for k in nums if k <= limit])
%o A347008     return sorted(k for k in counts if counts[k] == 2)
%o A347008 print(aupto(2604)) # _Michael S. Branicky_, Aug 10 2021
%Y A347008 Cf. A198277.
%K A347008 nonn
%O A347008 1,1
%A A347008 _J. M. Bergot_ and _Robert Israel_, Aug 10 2021