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.

Showing 1-4 of 4 results.

A065720 Primes whose binary representation is also the decimal representation of a prime.

Original entry on oeis.org

3, 5, 23, 47, 89, 101, 149, 157, 163, 173, 179, 199, 229, 313, 331, 367, 379, 383, 443, 457, 523, 587, 631, 643, 647, 653, 659, 709, 883, 947, 997, 1009, 1091, 1097, 1163, 1259, 1277, 1283, 1289, 1321, 1483, 1601, 1669, 1693, 1709, 1753, 1877, 2063, 2069, 2099
Offset: 1

Views

Author

Patrick De Geest, Nov 15 2001

Keywords

Comments

In general rebase notation (Marc LeBrun): p2 = (2) [p] (10).
Also: Primes in A036952. - M. F. Hasler, Dec 11 2012
See A089971 for the binary representation of these terms. - M. F. Hasler, Jan 05 2014

Examples

			1009{10} = 1111110001{2} is prime, and 1111110001{10} is also prime.
89 is in the sequence because it is a prime. Binary representation of 89 = 1011001, which is also a prime.
		

Crossrefs

Programs

  • Maple
    select(t -> isprime(t) and isprime(convert(t,binary)),[seq(2*i+1,i=1..1000)]); # Robert Israel, Jul 08 2014
  • Mathematica
    Select[ Range[1900], PrimeQ[ # ] && PrimeQ[ FromDigits[ IntegerDigits[ #, 2]]] & ]
    Select[ Prime@ Range@ 330, PrimeQ[ FromDigits[ IntegerDigits[#, 2]]] &] (* Robert G. Wilson v, Oct 09 2014 *)
  • PARI
    isok(p) = isprime(p) && isprime(fromdigits(binary(p), 10)); \\ Michel Marcus, Mar 04 2022
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(n) and isprime(int(bin(n)[2:]))
    print([k for k in range(2100) if ok(k)]) # Michael S. Branicky, Mar 04 2022

Formula

Equals A036952 intersect A000040. - M. F. Hasler, Dec 11 2012

Extensions

a(48)-a(50) from K. D. Bajpai, Jul 04 2014

A123266 Primes p such that the decimal expansion of p remains prime under two iterations of base-10 to base-2 conversions.

Original entry on oeis.org

5, 1097, 2237, 2689, 3541, 12979, 13477, 22367, 22783, 27701, 28499, 33521, 33613, 43093, 51839, 55487, 57383, 65423, 69931, 70201, 71429, 74209, 80599, 82267, 82889, 83591, 95009, 99079, 99881, 105929, 122201, 123923, 125261
Offset: 1

Views

Author

Martin Raab, Oct 09 2006

Keywords

Comments

More precisely, "... remains prime under two iterations of base-10 to base-2 conversions, but not three iterations."
.

Examples

			5 is a term because 5_10 = 101_2 and 101_10 = 1100101_2 and both 101 and 1100101 are prime in base 10.
		

Crossrefs

Programs

  • Mathematica
    okQ[n_] := And @@ PrimeQ[Rest[NestList[FromDigits[IntegerDigits[#, 2]] &, n, 2]]]; Select[Prime[Range[20000]], okQ] (* Harvey P. Dale, Jan 14 2011 *)
  • PARI
    A007088(n)=fromdigits(binary(n),10)
    is(n)=isprime(n) && isprime(n=A007088(n)) && isprime(A007088(n)) \\ Charles R Greathouse IV, Apr 08 2015

A256621 Primes p such that the decimal expansion of p remains prime under three iterations of base-10 to base-2 conversion.

Original entry on oeis.org

3893257, 9023533, 11005327, 11659009, 18747809, 21855233, 25183007, 34074379, 54298687, 58562951, 60496981, 89891273, 94277683, 96602887, 102276859, 115555927, 117578429, 122191543, 125115709, 132837283, 138169991, 139442753, 168852077, 183879649, 184904831
Offset: 1

Views

Author

Sebastian Petzelberger, Apr 06 2015

Keywords

Examples

			The 3 iterations: 3893257 --> 1110110110100000001001 --> ... --> ... are prime.
		

Crossrefs

Programs

  • PARI
    isok(n, nb=3) = {for (k=1, nb, b = binary(n); d = eval(subst(Pol(b), x, 10)); if (! isprime(d), return (0)); n = d;); return (1);} \\ Michel Marcus, Apr 08 2015

A361312 Smallest prime p such that the decimal expansion of p remains prime through exactly n iterations of base-10 to base-2 conversion (A007088).

Original entry on oeis.org

2, 3, 5, 3893257, 9632552297
Offset: 0

Views

Author

Ya-Ping Lu, Mar 08 2023

Keywords

Comments

Prime numbers that remain primes after 1, 2, 3, and 4 iterations are A065720, A123266, A256621 and A256622, respectively.

Examples

			a(0) = 2 because prime number 2 in base 2 is 10, and 10 in base 10 is not a prime.
a(1) = 3 because 3 = 11_2 and 11_10 is a prime. In the second iteration, however, 11_10 = 1011_2 and 1011_10 is not a prime.
a(2) = 5 because 5 = 101_2 and 101_10 = 1100101_2. Both 101 and 1100101 are primes in base 10. In the third iteration, 1100101_10 = 100001100100101000101_2 and 100001100100101000101_10 is not a prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime, nextprime
    p = 1; mx = 5; I = [*range(mx)]; R = [*range(mx)]
    while I:
        p = nextprime(p); ct = 0; q = p
        while isprime(int(bin(q)[2:])): ct += 1; q = int(bin(q)[2:])
        if ct in I: R[ct] = p; I.remove(ct)
    print(*R, sep = ", ")
Showing 1-4 of 4 results.