A356947 Emirps p such that p == 1 (mod s) and R(p) == 1 (mod s), where R(p) is the digit reversal of p and s the sum of digits of p.
1021, 1031, 1201, 1259, 1301, 9521, 10253, 10711, 11071, 11161, 11243, 11701, 12113, 12241, 14221, 15907, 16111, 16481, 17011, 17491, 18461, 19471, 30757, 31121, 34211, 35201, 70951, 71347, 71569, 72337, 73327, 74317, 75703, 96517, 100621, 101611, 101701, 102061, 102913, 103141, 105211, 106661
Offset: 1
Examples
a(3) = 1201 is a term because it and its digit reversal 1021 are distinct primes with sum of digits 4, and 1201 == 1021 == 1 (mod 4).
Links
- Robert Israel, Table of n, a(n) for n = 1..1000
Programs
-
Maple
filter:= proc(n) local L,i,r,s; if not isprime(n) then return false fi; L:= convert(n,base,10); r:= add(L[-i]*10^(i-1),i=1..nops(L)); if r = n or not isprime(r) then return false fi; s:= convert(L,`+`); n mod s = 1 and r mod s = 1 end proc: select(filter, [seq(i,i=13 .. 200000, 2)]);
-
Mathematica
Select[Range[110000], (r = IntegerReverse[#]) != # && PrimeQ[#] && PrimeQ[r] && Divisible[# - 1, (s = Plus @@ IntegerDigits[#])] && Divisible[r - 1, s] &] (* Amiram Eldar, Sep 06 2022 *)
-
Python
from sympy import isprime def ok(n): strn = str(n) R, s = int(strn[::-1]), sum(map(int, strn)) return n != R and n%s == 1 and R%s == 1 and isprime(n) and isprime(R) print([k for k in range(10**6) if ok(k)]) # Michael S. Branicky, Sep 06 2022
Comments