cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A340290 Numbers k that are the representation of primes in base 3 and in base 4.

This page as a plain text file.
%I A340290 #52 Dec 15 2021 16:35:26
%S A340290 2,1121,2021,2111,10121,10211,11201,12011,12121,12211,21101,21211,
%T A340290 22111,101021,101111,110021,110111,110221,111211,112001,121001,121021,
%U A340290 122011,200111,201101,210011,211021,211111,222221,1000211,1002011,1010111,1011121,1012201,1021001
%N A340290 Numbers k that are the representation of primes in base 3 and in base 4.
%C A340290 Except for a(1) = 2, which is the only even prime, all terms end with 1.
%C A340290 The corresponding sequences of primes are A235473 (for base 3) and A235467 (for base 4) (see examples).
%C A340290 As 1381 = 1220011_3 = 111211_4, prime 1381 occurs twice and is the next such prime after 2 (see example), which has a representation in base 3 and a representation in base 4 that are both terms of this sequence.
%H A340290 Chai Wah Wu, <a href="/A340290/b340290.txt">Table of n, a(n) for n = 1..10000</a>
%e A340290 a(1) = 2 and 2_3 = 2_4 = 2_10.
%e A340290 a(2) = 1121 because 1121_3 = 43_10 and 1121_4 = 89_10 are primes.
%e A340290 a(3) = 2021 because 2021_3 = 61_10 and 2021_4 = 137_10 are primes.
%t A340290 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 *)
%t A340290 FromDigits[#]&/@Select[Tuples[{0,1,2},7],PrimeQ[FromDigits[#,4]] && PrimeQ[ FromDigits[ #,3]]&] (* _Harvey P. Dale_, Dec 15 2021 *)
%o A340290 (PARI) f(n, b) = fromdigits(digits(n, b));
%o A340290 my(vp=primes(700)); setintersect(apply(x->f(x,3), vp), apply(x->f(x,4), vp)) \\ _Michel Marcus_, Jan 04 2021
%o A340290 (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
%o A340290 (Python)
%o A340290 from sympy import prime, isprime
%o A340290 from sympy.ntheory.factor_ import digits
%o A340290 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
%Y A340290 Intersection of A001363 and A004678.
%Y A340290 Cf. A089981 (bases 3 and 10).
%Y A340290 Cf. A235467, A235473.
%K A340290 nonn,base
%O A340290 1,1
%A A340290 _Bernard Schott_, Jan 03 2021
%E A340290 More terms from _Amiram Eldar_, Jan 03 2021