login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A235266 Primes whose base-2 representation is also the base-3 representation of a prime. 70
2, 7, 11, 13, 41, 47, 67, 73, 79, 109, 127, 151, 173, 181, 191, 193, 211, 223, 227, 229, 233, 251, 283, 331, 367, 421, 443, 487, 541, 557, 563, 587, 601, 607, 631, 641, 661, 677, 719, 733, 877, 941, 947, 967, 971, 1033, 1187, 1193, 1201, 1301, 1321, 1373, 1447, 1451, 1471, 1531, 1567, 1571, 1657, 1667, 1669, 1697, 1709, 1759 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
FORMULA
a(n) is the number whose base-3 representation is the base-2 representation of A235265(n).
MAPLE
f:= proc(n) local L, i;
L:= convert(n, base, 2);
isprime(add(L[i]*3^(i-1), i=1..nops(L)))
end proc:
select(f, [seq(ithprime(i), i=1..1000)]); # Robert Israel, Jun 03 2019
MATHEMATICA
Select[Prime@ Range@ 250, PrimeQ@ FromDigits[IntegerDigits[#, 2], 3] &] (* Michael De Vlieger, Jun 03 2019 *)
PROG
(PARI) is(p, b=3, c=2)=isprime(vector(#d=digits(p, c), i, b^(#d-i))*d~)&&isprime(p) \\ This code can be used for other bases b, c when b>c. See A235265 for code valid for b<c.
(PARI) forprime(p=2, 1e3, if(isprime(fromdigits(binary(p), 3)), print1(p", "))) \\ Charles R Greathouse IV, Mar 28 2022
(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 p
p = nextprime(p)
g = agen()
print([next(g) for n in range(1, 65)]) # Michael S. Branicky, Jan 16 2022
CROSSREFS
Cf. A090707 - A091924, A235461 - A235482. See the LINK for further cross-references.
Sequence in context: A117048 A040128 A209630 * A140548 A243630 A341076
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Jan 05 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 14:49 EDT 2024. Contains 371914 sequences. (Running on oeis4.)