login
A357117
Sums of two consecutive primes whose reversal is also the sum of two consecutive primes.
1
5, 8, 24, 42, 210, 222, 240, 258, 288, 434, 480, 630, 696, 810, 828, 852, 882, 2100, 2112, 2580, 2610, 2640, 2728, 2740, 2780, 2886, 2904, 2992, 4056, 4092, 4224, 4260, 4268, 4296, 4340, 4410, 4458, 4476, 4554, 4680, 4688, 4698, 4860, 6078, 6090, 6300, 6336, 6378, 6504, 6690, 6720, 6744, 6798
OFFSET
1,1
COMMENTS
Members k of A001043 such that A004086(k) is in A001043.
If k is in the sequence and does not end in 0, then the reversal of k is also in the sequence.
LINKS
EXAMPLE
a(5) = 210 is a member because 210 = 103+107 where 103 and 107 are consecutive primes, and its reversal 12 = 5+7 where 5 and 7 are consecutive primes.
MAPLE
rev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L));
end proc:
P:= select(isprime, [2, seq(i, i=3..50000, 2)]):
P2:= convert(P[1..-2]+P[2..-1], set):
A:= sort(convert(select(t -> member(rev(t), P2), P2), list));
MATHEMATICA
g = {}; For[m = 1, m <= 6800, m++ , n = FromDigits[Reverse[IntegerDigits[m]]]; If[NextPrime[(m + 1)/2, -1] + NextPrime[(m - 1)/2] == m && !PrimeQ[m/2] && NextPrime[(n + 1)/2, -1] + NextPrime[(n - 1)/2] == n && !PrimeQ[n/2], AppendTo[g, m]]]; Print[g] (* Samuel Harkness, Sep 19 2022 *)
PROG
(Python)
from itertools import islice
from sympy import isprime, nextprime, prevprime
def isA001043(n):
if n < 6: return n == 5
h = n//2
return not isprime(h) and n == prevprime(h) + nextprime(h)
def agen():
p, q, s = 2, 3, 5
while True:
if isA001043(int(str(s)[::-1])): yield s
p, q = q, nextprime(q); s = p+q
print(list(islice(agen(), 53))) # Michael S. Branicky, Sep 19 2022
CROSSREFS
Cf. A001043, A004086. Contains A162571.
Sequence in context: A271008 A272577 A140113 * A368484 A346552 A375350
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Sep 18 2022
STATUS
approved