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-8 of 8 results.

A090707 Primes whose decimal representation is a valid number in base 4 and interpreted as such is again a prime.

Original entry on oeis.org

2, 3, 11, 13, 23, 31, 101, 103, 113, 131, 211, 223, 233, 311, 331, 1013, 1021, 1033, 1103, 1201, 1213, 1223, 1231, 1301, 2003, 2111, 2113, 2131, 2203, 2213, 2311, 2333, 3001, 3011, 3203, 3221, 3301, 3323, 10111, 10211, 10303, 10313, 10321, 10331
Offset: 1

Views

Author

Cino Hilliard, Jan 18 2004

Keywords

Examples

			13 is prime in decimal and also when considered as a number in base 4: 13 [base 4] = 7 [base 10] which is also prime.
		

Crossrefs

Programs

  • Mathematica
    Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 4], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *)
    FromDigits[#,10]&/@Select[Tuples[{0,1,2,3},5],AllTrue[{FromDigits[#,4],FromDigits[#,10]},PrimeQ]&] (* Harvey P. Dale, Jul 30 2021 *)
  • PARI
    forprime(p=2,1e4, if(isprime(t=fromdigits(digits(p,4))), print1(t", "))) \\ Charles R Greathouse IV, Apr 22 2015

Extensions

Name, example and offset corrected by M. F. Hasler, Jan 03 2014

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

A089981 Primes whose decimal representation also represents a prime in base 3.

Original entry on oeis.org

2, 2111, 2221, 10211, 12011, 12211, 20201, 21011, 21101, 21211, 22111, 101021, 101111, 102101, 102121, 110221, 111121, 111211, 120011, 120121, 121001, 121021, 122011, 201101, 202001, 202021, 210011, 210101, 1000211, 1010201, 1012201
Offset: 1

Views

Author

Cino Hilliard, Jan 18 2004

Keywords

Comments

See A065721 for the primes given by these terms considered as numbers written in base 3, i.e., the sequence with the definition "working in the opposite sense". - M. F. Hasler, Jan 05 2014

Examples

			2111 is a prime and its decimal representation is also a valid base-3 representation (because all digits are < 3), and 2111[3] = 67[10] is again a prime. Therefore 2111 is in the sequence.
		

Crossrefs

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

Programs

  • Mathematica
    Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 3], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *)
    FromDigits/@Select[Tuples[{0,1,2},7],AllTrue[{FromDigits[#],FromDigits[ #,3]},PrimeQ]&] (* Harvey P. Dale, Aug 15 2022 *)
  • PARI
    is_A089981(p)=vecmax(d=digits(p))<3&&isprime(vector(#d,i,3^(#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, as below, or to very large numbers. - M. F. Hasler, Jan 05 2014
    
  • PARI
    forprime(p=2,1e6,is_A089981(p)&&print1(p",")) \\ - 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, 3), if(isprime(t=fromdigits(digits(p, 3), 10)), listput(v, t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016

Extensions

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

A235394 Primes whose decimal representation is a valid number in base 8 and interpreted as such is again a prime.

Original entry on oeis.org

2, 3, 5, 7, 13, 23, 37, 53, 73, 103, 107, 131, 211, 227, 263, 277, 307, 337, 373, 401, 431, 433, 463, 467, 521, 541, 547, 557, 577, 631, 643, 661, 673, 701, 1013, 1063, 1151, 1153, 1201, 1223, 1327, 1423, 1451, 1453, 1531, 1567, 1613, 1627, 1663, 1721, 2011, 2017
Offset: 1

Views

Author

Robert G. Wilson v, Jan 09 2014

Keywords

Examples

			a(5) = 13_10 = prime(5), 13_8 = 3 + 1*8 = 11_10 = prime(4).
a(8) = 53_10 = prime(16), 53_8 = 3 + 5*8 = 43_10 = prime(14). - _Marius A. Burtea_, Jun 30 2019
		

Crossrefs

Programs

  • Magma
    [n:n in PrimesUpTo(2100)| Max(Intseq(n,10)) le 7 and IsPrime(Seqint(Intseq(Seqint(Intseq(n),8))))]; // Marius A. Burtea, Jun 30 2019
  • Mathematica
    Select[FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 8], PrimeQ]
  • 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,8), if(isprime(t=fromdigits(digits(p,8),10)), listput(v,t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016
    

A235395 Primes whose decimal representation is a valid number in base 9 and interpreted as such is again a prime.

Original entry on oeis.org

2, 3, 5, 7, 41, 47, 67, 131, 151, 241, 331, 337, 461, 557, 601, 641, 661, 751, 757, 827, 887, 1031, 1181, 1217, 1231, 1321, 1327, 1367, 1471, 1637, 1877, 2027, 2081, 2111, 2131, 2207, 2281, 2287, 2351, 2357, 2647, 2731, 2861, 3037, 3121, 3181, 3187, 3307, 3347
Offset: 1

Views

Author

Robert G. Wilson v, Jan 09 2014

Keywords

Crossrefs

Programs

  • Mathematica
    Select[FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 9], PrimeQ]
  • 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, 9), if(isprime(t=fromdigits(digits(p, 9), 10)), listput(v, t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016

A235265 Primes whose base-3 representation also is the base-2 representation of a prime.

Original entry on oeis.org

3, 13, 31, 37, 271, 283, 733, 757, 769, 1009, 1093, 2281, 2467, 2521, 2551, 2917, 3001, 3037, 3163, 3169, 3187, 3271, 6673, 7321, 7573, 9001, 9103, 9733, 19801, 19963, 20011, 20443, 20521, 20533, 20749, 21871, 21961, 22123, 22639, 22717, 27253, 28711, 28759, 29173, 29191, 59077, 61483, 61507, 61561, 65701, 65881
Offset: 1

Views

Author

M. F. Hasler, Jan 05 2014

Keywords

Comments

This sequence and A235383 and A229037 are winners in the contest held at the 2014 AMS/MAA Joint Mathematics Meetings. - T. D. Noe, Jan 20 2014
This sequence was motivated by work initiated by V.J. Pohjola's post to the SeqFan list, which led to a clarification of the definition and correction of some errors, in sequences A089971, A089981 and A090707 through A090721. These sequences use "rebasing" (terminology of A065361) from some base b to base 10. Sequences A065720 - A065727 follow the same idea but use rebasing in the other sense, from base 10 to base b. The observation that only (10,b) and (b,10) had been considered so far led to the definition of this and related sequences: In a systematic approach, it seems natural to start with the smallest possible pairs of different bases, (2,3) and (3,2), then (2 <-> 4), (3 <-> 4), (2 <-> 5), etc.
Among the two possibilities using the smallest possible bases, 2 and 3, the present one seems a little bit more interesting, among others because not every base-3 representation is a valid base-2 representation (in contrast to the opposite case). This is also a reason why the present sequence grows much faster than the partner sequence A235266.

Examples

			3 = 10_3 and 10_2 = 2 is prime. 13 = 111_3 and 111_2 = 7 is prime.
		

Crossrefs

Subset of A077717.
Cf. A235266, A065720 and A036952, A065721 - A065727, A235394, A235395, A089971 and A020449, A089981, A090707 - A091924, A235461 - A235482. See M. F. Hasler's OEIS wiki page for further cross-references.

Programs

  • Maple
    N:= 1000: # to get the first N terms
    count:= 0:
    for i from 1 while count < N do
       p2:= ithprime(i);
       L:= convert(p2,base,2);
       p3:= add(3^(j-1)*L[j],j=1..nops(L));
       if isprime(p3) then
          count:= count+1;
          A235265[count]:= p3;
       fi
    od:
    [seq(A235265[i], i=1..N)]; # Robert Israel, May 04 2014
  • Mathematica
    b32pQ[n_]:=Module[{idn3=IntegerDigits[n,3]},Max[idn3]<2&&PrimeQ[ FromDigits[ idn3,2]]]; Select[Prime[Range[7000]],b32pQ] (* Harvey P. Dale, Apr 24 2015 *)
  • PARI
    is(p,b=2,c=3)=vecmax(d=digits(p,c))
    				
  • 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 p3
            p = nextprime(p)
    g = agen()
    print([next(g) for n in range(1, 52)]) # Michael S. Branicky, Jan 16 2022

A090710 Primes with digits less than 7 whose decimal representation is also a prime when interpreted in base 7.

Original entry on oeis.org

2, 3, 5, 23, 41, 43, 61, 113, 131, 241, 313, 401, 421, 443, 461, 463, 661, 1013, 1033, 1051, 1123, 1231, 1301, 1433, 1453, 1543, 1613, 2111, 2131, 2153, 2203, 2333, 2441, 2531, 2551, 3121, 3163, 3251, 3323, 3433, 3541, 4001, 4111, 4153, 4201, 4241, 4421
Offset: 1

Views

Author

Cino Hilliard, Jan 18 2004

Keywords

Comments

Note that the definition of, e.g., A090714 works "the other way round". - M. F. Hasler, Jan 03 2014

Examples

			23 is a prime and a valid number in base 7, and 23 [base 7] = 17 [base 10] is again a prime.
		

Crossrefs

Programs

  • Mathematica
    Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 7], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *)
    FromDigits/@Select[Tuples[{0,1,2,3,4,5,6},4],AllTrue[ {FromDigits[ #], FromDigits[ #,7]}, PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 29 2015 *)
  • PARI
    is_A090710(p,b=7)=vecmax(d=digits(p))M. F. Hasler, Jan 03 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, 7), if(isprime(t=fromdigits(digits(p, 7), 10)), listput(v, t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016

Extensions

Name, example and offset corrected by M. F. Hasler, Jan 03 2014

A090708 Primes whose decimal representation is a valid number in base 5 and interpreted as such is again a prime.

Original entry on oeis.org

2, 3, 23, 43, 131, 241, 313, 401, 1123, 1231, 1321, 2111, 2113, 2221, 2311, 3323, 4003, 4241, 4423, 10103, 10301, 10433, 11243, 11423, 12011, 12413, 13331, 14323, 14411, 20113, 20201, 20443, 21011, 21143, 21341, 21433, 22111, 22133, 22441, 23431, 24113, 24421, 24443, 30211, 31223
Offset: 1

Views

Author

Cino Hilliard, Jan 18 2004

Keywords

Examples

			23 is prime when read as base-10 number and also when read as base-5 number, 23 [base 5] = 13 [base 10].
		

Crossrefs

Programs

  • Magma
    [n:n in PrimesUpTo(32000)| Max(Intseq(n,10)) le 4 and IsPrime(Seqint(Intseq(Seqint(Intseq(n),5))))]; // Marius A. Burtea, Jun 30 2019
  • Mathematica
    Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 5], PrimeQ] (* Robert G. Wilson v, 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, 5), if(isprime(t=fromdigits(digits(p, 5), 10)), listput(v, t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016
    

Extensions

Name, example and offset corrected by M. F. Hasler, Jan 03 2014
More terms from Alejandro J. Becerra Jr., Aug 13 2018
Showing 1-8 of 8 results.