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.
%I A350781 #15 Mar 22 2025 14:04:07 %S A350781 419,599,647,12497,13487,14461,15467,15991,16981,17431,17551,18097, %T A350781 18521,18541,19087,19427,20921,20929,22039,22349,22501,22567,22621, %U A350781 22669,22859,24091,24329,24799,26099,26209,26297,26309,26399,26501,26557,26699,26711,26849,28019,28051,28537,28597,28669 %N A350781 Primes p whose reverse q is a semiprime, and of p+q and its reverse one is a prime and the other is a semiprime. %H A350781 Robert Israel, <a href="/A350781/b350781.txt">Table of n, a(n) for n = 1..10000</a> %e A350781 a(3) = 647 is a term because 647 is prime, its reverse 746 = 2*373 is a semiprime, 647+746 = 1393 = 7*199 is a semiprime, and the reverse 3931 of 1393 is a prime. %p A350781 filter:= proc(p) local q,r,s; %p A350781 if not isprime(p) then return false fi; %p A350781 q:= digrev(p); %p A350781 if numtheory:-bigomega(q) <> 2 then return false fi; %p A350781 r:= p+q; %p A350781 s:= digrev(r); %p A350781 {numtheory:-bigomega(r), numtheory:-bigomega(s)} = {1,2} %p A350781 end proc: %p A350781 digrev:= proc(n) local L,i; %p A350781 L:= convert(n,base,10); %p A350781 add(L[-i]*10^(i-1),i=1..nops(L)) %p A350781 end proc: %p A350781 select(filter, [seq(i,i=3..10^5,2)]); %t A350781 semiQ[n_] := PrimeOmega[n] == 2; q1[p_] := PrimeQ[p] && semiQ[IntegerReverse[p]]; q2[p_] := semiQ[p] && PrimeQ[IntegerReverse[p]]; q[p_] := q1[p] && (q1[(s = p + IntegerReverse[p])] || q2[s]); Select[Range[30000], q] (* _Amiram Eldar_, Jan 16 2022 *) %t A350781 pspQ[p_]:=With[{q=IntegerReverse[p]},PrimeOmega[q]==2&&Sort[PrimeOmega/@{p+q,IntegerReverse[p+q]}]=={1,2}]; Select[Prime[ Range[ 3500]],pspQ] (* _Harvey P. Dale_, Mar 22 2025 *) %o A350781 (Python) %o A350781 from sympy import isprime, factorint %o A350781 def issemip(n): return sum(factorint(n).values()) == 2 %o A350781 def ok(p): %o A350781 if not isprime(p): return False %o A350781 q = int(str(p)[::-1]) %o A350781 if not issemip(q): return False %o A350781 r = int(str(p+q)[::-1]) %o A350781 return (isprime(p+q) and issemip(r)) or (isprime(r) and issemip(p+q)) %o A350781 print([k for k in range(30000) if ok(k)]) # _Michael S. Branicky_, Jan 15 2022 %Y A350781 Cf. A001358. %Y A350781 Subsequence of A085778. %K A350781 nonn,base %O A350781 1,1 %A A350781 _J. M. Bergot_ and _Robert Israel_, Jan 15 2022