login
A368805
Primes whose digits are prime in both base 9 and base 10.
0
2, 3, 5, 7, 23, 227, 277, 2777, 5333, 5573, 23537, 23753, 25373, 225527, 25737557, 27775337, 27775357, 35275777, 35277233, 37333757, 227773753, 227775533, 232372577, 233752577, 252777737, 337777277, 25322233723, 25322237323, 25322237357, 25322237723, 25322327753, 25322327777, 25322532523
OFFSET
1,1
COMMENTS
Subsequence of A019546.
EXAMPLE
2777 is in this sequence because it is prime, all its digits are prime and 2777 in base 9 is 3725, whose digits are all prime.
MATHEMATICA
Select[Range[2.1*10^7], PrimeQ[#]&&AllTrue[IntegerDigits[#], PrimeQ]&&AllTrue[IntegerDigits[#, 9], PrimeQ]&] (* or *)
seq1[dignum_, b_] := Module[{s = {}}, Do[s = Join[s, Select[FromDigits[#, b] & /@ Tuples[{2, 3, 5, 7}, k], PrimeQ]], {k, 1, dignum}]; s]; seq[maxdig9_] := Select[Intersection[seq1[maxdig9, 9], seq1[maxdig9, 10]], # <= 9^maxdig9 &]; seq[11] (* Amiram Eldar, Jan 06 2024 *)
PROG
(Python)
from gmpy2 import digits, is_prime
from itertools import count, islice, product
def bgen():
yield from [2, 3, 5, 7]
for d in count(2):
for f in product("2357", repeat=d-1):
for last in "37":
yield int("".join(f)+last)
def agen(): yield from (t for t in bgen() if is_prime(t) and set(digits(t, 9)) <= set("2357"))
print(list(islice(agen(), 33))) # Michael S. Branicky, Jan 07 2024
CROSSREFS
Sequence in context: A343834 A070029 A360497 * A262339 A110094 A088054
KEYWORD
nonn,base
AUTHOR
James C. McMahon, Jan 06 2024
STATUS
approved