login
A359840
Numbers k that are the representation of primes in base 4 and in base 5.
0
2, 3, 23, 131, 133, 221, 1211, 1231, 2023, 2111, 2113, 2311, 3013, 3211, 3233, 3323, 10031, 10033, 10121, 12011, 12121, 13223, 13331, 20131, 20203, 22111, 23233, 31313, 32033, 32303, 33133, 33331, 100123, 100211, 100231, 101003, 101333, 103333, 110021, 111211
OFFSET
1,1
COMMENTS
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).
The corresponding sequences of primes are A235474 (for base 4) and A235615 (for base 5).
FORMULA
a(n) = A007090(A235474(n)); a(n) = A007091(A235615(n)).
EXAMPLE
a(3) = 23 because 23_4 = 11_10 = A235474(3) and 23_5 = 13_10 = A235615(3) are primes.
a(9) = 2023 because 2023_4 = 139_10 = A235474(9) and 2023_5 = 263_10 = A235615(9) are primes.
MATHEMATICA
q[n_, b_] := Max[d = IntegerDigits[n]] < b && PrimeQ[FromDigits[d, b]]; Select[Range[200000], q[#, 4] && q[#, 5] &] (* Amiram Eldar, Jan 15 2023 *)
PROG
(Python)
from sympy import isprime
def ok(n): return max(s:=str(n)) < '4' and isprime(int(s, 4)) and isprime(int(s, 5))
print([k for k in range(10**6) if ok(k)]) # Michael S. Branicky, Jan 15 2023
(Python)
from sympy import isprime
from itertools import count, islice, product
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)))
print(list(islice(agen(), 40))) # Michael S. Branicky, Jan 15 2023
CROSSREFS
Intersection of A004678 and A004679.
Sequence in context: A093504 A370279 A009180 * A041459 A126702 A260126
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jan 15 2023
EXTENSIONS
More terms from Amiram Eldar, Jan 15 2023
STATUS
approved