A340290 Numbers k that are the representation of primes in base 3 and in base 4.
2, 1121, 2021, 2111, 10121, 10211, 11201, 12011, 12121, 12211, 21101, 21211, 22111, 101021, 101111, 110021, 110111, 110221, 111211, 112001, 121001, 121021, 122011, 200111, 201101, 210011, 211021, 211111, 222221, 1000211, 1002011, 1010111, 1011121, 1012201, 1021001
Offset: 1
Examples
a(1) = 2 and 2_3 = 2_4 = 2_10. a(2) = 1121 because 1121_3 = 43_10 and 1121_4 = 89_10 are primes. a(3) = 2021 because 2021_3 = 61_10 and 2021_4 = 137_10 are primes.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
f[n_] := Module[{d = IntegerDigits[n, 3]}, If[PrimeQ[FromDigits[d, 4]], FromDigits[d, 10], 0]]; seq = {}; Do[If[PrimeQ[n], m = f[n]; If[m > 0, AppendTo[seq, m]]], {n, 2, 1000}]; seq (* Amiram Eldar, Jan 03 2021 *) FromDigits[#]&/@Select[Tuples[{0,1,2},7],PrimeQ[FromDigits[#,4]] && PrimeQ[ FromDigits[ #,3]]&] (* Harvey P. Dale, Dec 15 2021 *)
-
PARI
f(n, b) = fromdigits(digits(n, b)); my(vp=primes(700)); setintersect(apply(x->f(x,3), vp), apply(x->f(x,4), vp)) \\ Michel Marcus, Jan 04 2021
-
PARI
forprime(p=2, 10^3, my(t=digits(p,3)); if( isprime( fromdigits(t,4)), print1(fromdigits(t,10),", "))) \\ Joerg Arndt, Jan 04 2021
-
Python
from sympy import prime, isprime from sympy.ntheory.factor_ import digits A340290_list = [int(s) for s in (''.join(str(d) for d in digits(prime(i),3)[1:]) for i in range(1,1000)) if isprime(int(s,4))] # Chai Wah Wu, Jan 09 2021
Extensions
More terms from Amiram Eldar, Jan 03 2021
Comments