A054258 Concatenation of n in base 2 up to base 10 and n in base 10 down to base 2 is prime, all numbers are interpreted as decimals.
2607, 4007, 4069, 7597, 12411, 13583, 23041, 31113, 32619, 46187, 48469, 55777, 61411, 64387, 71143, 73837, 84761, 103559, 123797, 124043, 126613, 136509, 142019, 147449, 183981, 186889, 200183, 204219, 214819, 221101, 224123, 230977, 235493, 249049, 256489
Offset: 1
Examples
a(1) = 2607 is a term since both 10100010111110120120220233404122002310413505735162607 and 26073516505710413200234041222023310120120101000101111 are prime.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Select[Range[250000],AllTrue[{FromDigits[Flatten[Table[IntegerDigits[#,b],{b,2,10}]]],FromDigits[ Flatten[Table[IntegerDigits[#,b],{b,10,2,-1}]]]},PrimeQ]&] (* Harvey P. Dale, May 28 2023 *)
-
Python
from gmpy2 import digits, is_prime def ok(n): return is_prime(int("".join(digits(n, b) for b in list(range(2, 11))))) and is_prime(int("".join(digits(n, b) for b in list(range(10, 1, -1))))) print([k for k in range(234567) if ok(k)]) # Michael S. Branicky, May 28 2023
Extensions
Offset changed to 1 and a(33) and beyond from Michael S. Branicky, May 28 2023