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.

A349709 Primes p such that if q is the next prime, A004086(p*q) = A004086(p)*A004086(q).

This page as a plain text file.
%I A349709 #56 Jan 05 2022 17:35:42
%S A349709 2,7,11,97,101,1021,1201,2003,3001,10103,10111,20011,20021,21001,
%T A349709 101111,102001,102101,112103,112111,120103,201011,202001,1000003,
%U A349709 1000211,1010003,1010201,1011001,1020011,1100101,1100311,1111013,1111021,1112003,1201001,2011201,2020001,2100001,2100011,10000103
%N A349709 Primes p such that if q is the next prime, A004086(p*q) = A004086(p)*A004086(q).
%H A349709 Robert Israel, <a href="/A349709/b349709.txt">Table of n, a(n) for n = 1..169</a>
%e A349709 a(6) = 1021 is a term because it is prime, the next prime is 1031, and the reverse of 1021*1031 = 1052651 is 1562501 = 1301*1201.
%p A349709 revdigs:= proc(n) local L,i,m;
%p A349709   L:= convert(n,base,10);
%p A349709   m:= nops(L);
%p A349709   add(L[i]*10^(m-i),i=1..m)
%p A349709 end proc:
%p A349709 R:= NULL: count:= 0:
%p A349709 q:= 2: qr:= 2:
%p A349709 while count < 50 do
%p A349709   p:= q; pr:= qr;
%p A349709   q:= nextprime(q); qr:= revdigs(q);
%p A349709   if pr*qr = revdigs(p*q) then
%p A349709      count:= count+1; R:= R, p;
%p A349709   fi
%p A349709 od:
%p A349709 R;
%t A349709 seqQ[p_] := PrimeQ[p] && Module[{r = IntegerReverse, q = NextPrime[p]}, r[p*q] == r[p] * r[q]]; Select[Range[2.2*10^6], seqQ] (* _Amiram Eldar_, Jan 05 2022 *)
%o A349709 (PARI) R(n) = fromdigits(Vecrev(digits(n))); \\ A004086
%o A349709 isok(p) = if (isprime(p), my(q=nextprime(p+1)); R(p*q) == R(p)*R(q)); \\ _Michel Marcus_, Jan 05 2022
%o A349709 (Python)
%o A349709 from itertools import islice
%o A349709 from sympy import isprime, nextprime
%o A349709 def R(n): return int(str(n)[::-1])
%o A349709 def agen(): # generator of terms
%o A349709     p, pr = 2, 2
%o A349709     while True:
%o A349709         q = nextprime(p)
%o A349709         qr = R(q)
%o A349709         if R(p*q) == pr * qr:
%o A349709             yield p
%o A349709         p, pr = q, qr
%o A349709 print(list(islice(agen(), 38))) # _Michael S. Branicky_, Jan 05 2022
%Y A349709 Cf. A004086.
%K A349709 nonn,base
%O A349709 1,1
%A A349709 _J. M. Bergot_ and _Robert Israel_, Jan 05 2022