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!)
A089971 Primes whose decimal representation also represents a prime in base 2. 74

%I #46 Mar 15 2023 03:29:08

%S 11,101,10111,101111,1011001,1100101,10010101,10011101,10100011,

%T 10101101,10110011,11000111,11100101,100111001,101001011,101101111,

%U 101111011,101111111,110111011,111001001,1000001011,1001001011,1001110111,1010000011,1010000111,1010001101

%N Primes whose decimal representation also represents a prime in base 2.

%C 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

%C A subsequence of A020449. - _M. F. Hasler_, Jan 11 2014

%H Charles R Greathouse IV, <a href="/A089971/b089971.txt">Table of n, a(n) for n = 1..10000</a>

%H Alejandro J. Becerra Jr., <a href="https://github.com/ajbecerr/OEIS/blob/main/A089971%2C%20A089981%2C%20A090707-A090710%2C%20A235394-A235395.ipynb">Python code for computing terms of A089971, A089981, A090707-A090710, A235394-A235395</a>.

%H Alejandro J. Becerra Jr., <a href="/A089971/a089971.txt">Table of n, a(n) for n = 1..42012</a>

%e 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.

%t Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 2], PrimeQ] (* _Robert G. Wilson v_, Jan 05 2014 *)

%o (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

%o (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)

%o 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

%o (Python)

%o from sympy import isprime, primerange

%o def aupto(limit):

%o alst = []

%o for p in primerange(2, limit+1):

%o t = int(bin(p)[2:])

%o if isprime(t): alst.append(t)

%o return alst

%o print(aupto(2**11)) # _Michael S. Branicky_, Aug 19 2021

%Y Cf. A031974, A089981, A090707, A090708, A090709, A090710, A235394, A235395, A000040 and references therein.

%K base,nonn

%O 1,1

%A _Cino Hilliard_, Jan 18 2004

%E Definition and example reworded, offset corrected, and cross-references added by _M. F. Hasler_, Jan 05 2014

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 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)