A235265 Primes whose base-3 representation also is the base-2 representation of a prime.
3, 13, 31, 37, 271, 283, 733, 757, 769, 1009, 1093, 2281, 2467, 2521, 2551, 2917, 3001, 3037, 3163, 3169, 3187, 3271, 6673, 7321, 7573, 9001, 9103, 9733, 19801, 19963, 20011, 20443, 20521, 20533, 20749, 21871, 21961, 22123, 22639, 22717, 27253, 28711, 28759, 29173, 29191, 59077, 61483, 61507, 61561, 65701, 65881
Offset: 1
Examples
3 = 10_3 and 10_2 = 2 is prime. 13 = 111_3 and 111_2 = 7 is prime.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- M. F. Hasler, Primes whose base c expansion is also the base b expansion of a prime
- Veikko Pohjola, A090709 Decimal primes whose decimal representation in base 6 is also prime, SeqFan list, Jan 03 2014.
Crossrefs
Programs
-
Maple
N:= 1000: # to get the first N terms count:= 0: for i from 1 while count < N do p2:= ithprime(i); L:= convert(p2,base,2); p3:= add(3^(j-1)*L[j],j=1..nops(L)); if isprime(p3) then count:= count+1; A235265[count]:= p3; fi od: [seq(A235265[i], i=1..N)]; # Robert Israel, May 04 2014
-
Mathematica
b32pQ[n_]:=Module[{idn3=IntegerDigits[n,3]},Max[idn3]<2&&PrimeQ[ FromDigits[ idn3,2]]]; Select[Prime[Range[7000]],b32pQ] (* Harvey P. Dale, Apr 24 2015 *)
-
PARI
is(p,b=2,c=3)=vecmax(d=digits(p,c))
-
Python
from sympy import isprime, nextprime def agen(): # generator of terms p = 2 while True: p3 = sum(3**i for i, bi in enumerate(bin(p)[2:][::-1]) if bi=='1') if isprime(p3): yield p3 p = nextprime(p) g = agen() print([next(g) for n in range(1, 52)]) # Michael S. Branicky, Jan 16 2022
Comments