[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
login
A089971
Primes whose decimal representation also represents a prime in base 2.
74
11, 101, 10111, 101111, 1011001, 1100101, 10010101, 10011101, 10100011, 10101101, 10110011, 11000111, 11100101, 100111001, 101001011, 101101111, 101111011, 101111111, 110111011, 111001001, 1000001011, 1001001011, 1001110111, 1010000011, 1010000111, 1010001101
OFFSET
1,1
COMMENTS
See A065720 for the primes given by these terms considered as numbers written in base 2, i.e., the sequence with the definition "working in the opposite sense". - M. F. Hasler, Jan 05 2014
A subsequence of A020449. - M. F. Hasler, Jan 11 2014
EXAMPLE
a(1)=11 is a prime and its decimal representation is also a valid base-2 representation (because all digits are < 2), and 11_2 = 3_10 is again a prime.
MATHEMATICA
Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 2], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *)
PROG
(PARI) is_A089971(p)=vecmax(d=digits(p))<2&&isprime(vector(#d, i, 2^(#d-i))*d~)&&isprime(p) \\ "d" is implicitly declared local. Putting isprime(p) to the end improves performance when the function is applied to primes only or to very large numbers. - M. F. Hasler, Jan 05 2014
(PARI) fixBase(n, oldBase, newBase)=my(d=digits(n, oldBase), t=newBase-1); for(i=1, #d, if(d[i]>t, for(j=i, #d, d[j]=t); break)); fromdigits(d, newBase)
list(lim)=my(v=List(), t); forprime(p=2, fixBase(lim\1, 10, 2), if(isprime(t=fromdigits(digits(p, 2), 10)), listput(v, t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016
(Python)
from sympy import isprime, primerange
def aupto(limit):
alst = []
for p in primerange(2, limit+1):
t = int(bin(p)[2:])
if isprime(t): alst.append(t)
return alst
print(aupto(2**11)) # Michael S. Branicky, Aug 19 2021
CROSSREFS
Cf. A031974, A089981, A090707, A090708, A090709, A090710, A235394, A235395, A000040 and references therein.
Sequence in context: A080439 A098153 A020449 * A082620 A199304 A156668
KEYWORD
base,nonn
AUTHOR
Cino Hilliard, Jan 18 2004
EXTENSIONS
Definition and example reworded, offset corrected, and cross-references added by M. F. Hasler, Jan 05 2014
STATUS
approved