| 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 (list; graph; refs; listen; history; edit; text; internal format) |
|
| OFFSET | 1,1 | | COMMENTS | | | LINKS | | | 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")) | | CROSSREFS | | | KEYWORD | nonn,base | | AUTHOR | | | STATUS | approved |
|
No comments:
Post a Comment