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.

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

Original entry on oeis.org

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

Views

Author

Cino Hilliard, Jan 18 2004

Keywords

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

Examples

			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.
		

Crossrefs

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

Programs

  • Mathematica
    Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 2], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *)
  • 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

Extensions

Definition and example reworded, offset corrected, and cross-references added by M. F. Hasler, Jan 05 2014