%I #29 Jan 20 2023 09:02:53
%S 2,3,23,131,133,221,1211,1231,2023,2111,2113,2311,3013,3211,3233,3323,
%T 10031,10033,10121,12011,12121,13223,13331,20131,20203,22111,23233,
%U 31313,32033,32303,33133,33331,100123,100211,100231,101003,101333,103333,110021,111211
%N Numbers k that are the representation of primes in base 4 and in base 5.
%C For a(1) = 2, 2_4 = 2_5 = 2_10 and for a(2) = 3, 3_4 = 3_5 = 3_10; otherwise, these two primes are distinct for n >= 3 (example).
%C The corresponding sequences of primes are A235474 (for base 4) and A235615 (for base 5).
%F a(n) = A007090(A235474(n)); a(n) = A007091(A235615(n)).
%e a(3) = 23 because 23_4 = 11_10 = A235474(3) and 23_5 = 13_10 = A235615(3) are primes.
%e a(9) = 2023 because 2023_4 = 139_10 = A235474(9) and 2023_5 = 263_10 = A235615(9) are primes.
%t q[n_, b_] := Max[d = IntegerDigits[n]] < b && PrimeQ[FromDigits[d, b]]; Select[Range[200000], q[#, 4] && q[#, 5] &] (* _Amiram Eldar_, Jan 15 2023 *)
%o (Python)
%o from sympy import isprime
%o def ok(n): return max(s:=str(n)) < '4' and isprime(int(s, 4)) and isprime(int(s, 5))
%o print([k for k in range(10**6) if ok(k)]) # _Michael S. Branicky_, Jan 15 2023
%o (Python)
%o from sympy import isprime
%o from itertools import count, islice, product
%o def agen(): yield from (int(s) for d in count(1) for f in "123" for r in product("0123", repeat=d-1) if isprime(int(s:=f+"".join(r), 4)) and isprime(int(s, 5)))
%o print(list(islice(agen(), 40))) # _Michael S. Branicky_, Jan 15 2023
%Y Intersection of A004678 and A004679.
%Y Cf. A007090, A007091, A235474, A235615, A340290.
%K nonn,base
%O 1,1
%A _Bernard Schott_, Jan 15 2023
%E More terms from _Amiram Eldar_, Jan 15 2023
|