A359174 First of three consecutive primes p, q, r, such that the reverse of p+q+r is divisible by at least one of p, q and r.
3, 7, 17, 53, 97, 193, 431, 1997, 5381, 30097, 128663, 278209, 385831, 481141, 1217509, 2401991, 2485831, 2625911, 3070037, 35912561, 39202231, 44531771, 45393841, 47084041, 50037011, 53639681, 54693481, 54949481, 55225217, 56094281, 56885351, 58632851, 59858651, 61030121, 62932621, 64195073, 64683491
Offset: 1
Examples
a(3) = 17 is a term because 17, 19, 23 are consecutive primes with 17 + 19 + 23 = 59 and the reverse of 59 is 95 which is divisible by 19.
Programs
-
Maple
rev:= proc(n) local L,i; L:= convert(n,base,10); add(L[-i]*10^(i-1),i=1..nops(L)) end proc: q:= 2: r:= 3: R:= NULL: count:= 0: while count < 50 do p:= q; q:= r; r:= nextprime(r); x:= rev(p+q+r); if x mod p = 0 or x mod q = 0 or x mod r = 0 then count:= count+1; R:= R,p; fi; od: R;
-
Mathematica
q[tri_] := AnyTrue[tri, Divisible[IntegerReverse[Total[tri]], #] &]; Select[Partition[Prime[Range[250000]], 3, 1], q][[;; , 1]] (* Amiram Eldar, Dec 28 2022 *)
-
Python
from sympy import nextprime from itertools import count, islice def agen(): # generator of terms p, q, r = 2, 3, 5 while True: t = int(str(p+q+r)[::-1]) if any(t%s == 0 for s in (p, q, r)): yield p p, q, r = q, r, nextprime(r) print(list(islice(agen(), 19))) # Michael S. Branicky, Dec 27 2022
Comments