login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A368805 Primes whose digits are prime in both base 9 and base 10. 0

%I #19 Feb 06 2024 11:57:59

%S 2,3,5,7,23,227,277,2777,5333,5573,23537,23753,25373,225527,25737557,

%T 27775337,27775357,35275777,35277233,37333757,227773753,227775533,

%U 232372577,233752577,252777737,337777277,25322233723,25322237323,25322237357,25322237723,25322327753,25322327777,25322532523

%N Primes whose digits are prime in both base 9 and base 10.

%C Subsequence of A019546.

%e 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.

%t Select[Range[2.1*10^7],PrimeQ[#]&&AllTrue[IntegerDigits[#],PrimeQ]&&AllTrue[IntegerDigits[#,9],PrimeQ]&] (* or *)

%t 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 *)

%o (Python)

%o from gmpy2 import digits, is_prime

%o from itertools import count, islice, product

%o def bgen():

%o yield from [2, 3, 5, 7]

%o for d in count(2):

%o for f in product("2357", repeat=d-1):

%o for last in "37":

%o yield int("".join(f)+last)

%o def agen(): yield from (t for t in bgen() if is_prime(t) and set(digits(t, 9)) <= set("2357"))

%o print(list(islice(agen(), 33))) # _Michael S. Branicky_, Jan 07 2024

%Y Cf. A000040, A019546.

%K nonn,base

%O 1,1

%A _James C. McMahon_, Jan 06 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 30 07:39 EDT 2024. Contains 373861 sequences. (Running on oeis4.)