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-10 of 128 results. Next

A100580 Palindromic primes containing digits 0 and 1 only. (Palindromic terms in A020449.)

Original entry on oeis.org

11, 101, 100111001, 110111011, 111010111, 1100011100011, 1100101010011, 1101010101011, 1110110110111, 1110111110111, 100110101011001, 101000010000101, 101011000110101, 101110000011101, 110011101110011
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Nov 29 2004

Keywords

Examples

			a(3) = 100111001 because 100111001 is the third palindromic prime composed only of 1's and 0's.
		

Crossrefs

Programs

  • Mathematica
    PalQ[n_]:=FromDigits[Reverse@IntegerDigits[n]]==n; DeleteDuplicates[Flatten[Table[Select[FromDigits /@ Tuples[{0,1},n],PrimeQ[#]&&PalQ[#] &],{n,15}]]] (* Jayanta Basu, May 11 2013 *)
    Select[FromDigits/@Tuples[{0,1},15],PalindromeQ[#]&&PrimeQ[#]&] (* Harvey P. Dale, Jan 18 2023 *)
  • Python
    from sympy import isprime
    A100580_list = [11]
    for i in range(2, 2**16):
        s = format(i, 'b')
        x = int(s+s[-2::-1])
        if isprime(x):
            A100580_list.append(x) # Chai Wah Wu, Jan 06 2015

A004022 Primes of the form (10^k - 1)/9. Also called repunit primes or repdigit primes.

Original entry on oeis.org

11, 1111111111111111111, 11111111111111111111111
Offset: 1

Views

Author

Keywords

Comments

The next term corresponds to k = 317 and is too large to include: see A004023.
Also called repunit primes or prime repunits.
Also, primes with digital product = 1.
The number of 1's in these repunits must also be prime. Since the number of 1's in (10^k-1)/9 is k, if k = p*m then (10^(p*m)-1) = (10^p)^m-1 => (10^p-1)/9 = q and q divides (10^k-1). This follows from the identity a^k - b^k = (a-b)*(a^(k-1) + a^(k-2)*b + ... + b^(k-1)). - Cino Hilliard, Dec 23 2008
A subset of A020449, ..., A020457, A036953, ..., cf. link to OEIS index. - M. F. Hasler, Jul 27 2015
The terms in this sequence, except 11 which is not Brazilian, are prime repunits in base ten, so they are Brazilian primes belonging to A085104 and A285017. - Bernard Schott, Apr 08 2017

References

  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, p. 11. Graham, Knuth and Patashnik, Concrete mathematics, Addison-Wesley, 1994; see p. 146, problem 22.
  • M. Barsanti, R. Dvornicich, M. Forti, T. Franzoni, M. Gobbino, S. Mortola, L. Pernazza and R. Romito, Il Fibonacci N. 8 (included in Il Fibonacci, Unione Matematica Italiana, 2011), 2004, Problem 8.10.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 60.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 114.

Crossrefs

Subsequence of A020449.
A116692 is another version of repunit primes or repdigit primes. - N. J. A. Sloane, Jan 22 2023
See A004023 for the number of 1's.
Cf. A046413.

Programs

  • Magma
    [a: n in [0..300] | IsPrime(a) where a is (10^n - 1) div 9 ]; // Vincenzo Librandi, Nov 08 2014
    
  • Mathematica
    lst={}; Do[If[PrimeQ[p = (10^n - 1)/9], AppendTo[lst, p]], {n, 10^2}]; lst (* Vladimir Joseph Stephan Orlovsky, Aug 22 2008 *)
    Select[Table[(10^n - 1) / 9, {n, 500}], PrimeQ] (* Vincenzo Librandi, Nov 08 2014 *)
    Select[Table[FromDigits[PadRight[{},n,1]],{n,30}],PrimeQ] (* Harvey P. Dale, Apr 07 2018 *)
  • PARI
    forprime(x=2,20000,if(ispseudoprime((10^x-1)/9),print1((10^x-1)/9","))) \\ Cino Hilliard, Dec 23 2008
    
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(): # generator of terms
        yield from (t for t in (int("1"*k) for k in count(1)) if isprime(t))
    print(list(islice(agen(), 4))) # Michael S. Branicky, Jun 09 2022

Formula

a(n) = A002275(A004023(n)).

Extensions

Edited by Max Alekseyev, Nov 15 2010
Name expanded by N. J. A. Sloane, Jan 22 2023

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

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

A235482 Primes whose base-5 representation is also the base-9 representation of a prime.

Original entry on oeis.org

2, 3, 7, 11, 17, 19, 37, 41, 61, 67, 71, 97, 109, 131, 139, 149, 151, 157, 167, 191, 197, 211, 251, 269, 281, 337, 349, 367, 401, 409, 439, 449, 457, 467, 487, 491, 499, 521, 557, 569, 607, 619, 631, 647, 661, 739, 761, 769, 821, 829, 887, 907, 941, 947, 967, 1009, 1019, 1031, 1061, 1069, 1087
Offset: 1

Views

Author

M. F. Hasler, Jan 12 2014

Keywords

Comments

This sequence is part of a two-dimensional array of sequences, given in the LINK, based on this same idea for any two different bases b, c > 1. Sequence A235265 and A235266 are the most elementary ones in this list. Sequences A089971, A089981 and A090707 through A090721, and sequences A065720 - A065727, follow the same idea with one base equal to 10.
A subsequence of A197636 and of course of A000040A015919.

Examples

			41 = 131_5 and 131_9 = 109 are both prime, so 41 is a term.
		

Crossrefs

Cf. A235265, A235266, A235461 - A235481, A065720A036952, A065721 - A065727, A089971A020449, A089981, A090707 - A091924, A235394, A235395. See the LINK for further cross-references.

Programs

  • Mathematica
    Select[Prime@ Range@ 500, PrimeQ@ FromDigits[ IntegerDigits[#, 5], 9] &] (* Giovanni Resta, Sep 12 2019 *)
  • PARI
    is(p,b=9,c=5)=isprime(vector(#d=digits(p,c),i,b^(#d-i))*d~)&&isprime(p) \\ Note: Code only valid for b > c.

A036952 Numbers whose binary expansion is a decimal prime.

Original entry on oeis.org

3, 5, 23, 47, 89, 101, 149, 157, 163, 173, 179, 185, 199, 229, 247, 253, 295, 313, 329, 331, 355, 367, 379, 383, 405, 425, 443, 453, 457, 471, 523, 533, 539, 565, 583, 587, 595, 631, 643, 647, 653, 659, 671, 675, 689, 703, 709, 755, 781, 785, 815, 841, 855
Offset: 1

Views

Author

Patrick De Geest, Jan 04 1999

Keywords

Comments

A100051(f(a(n))) = 1 with f(x) = if x<2 then x else 10*f(floor(x/2)) + x mod 2. - Reinhard Zumkeller, Mar 31 2010
Primes in A007088. - N. J. A. Sloane, Feb 17 2023

Examples

			1 = 1_2 is not a prime.
2 = 10_2 is not OK because 10 = 2*5 is not a prime.
3 = 11_2 is OK because 11 is a prime.
4 = 100_2 is not OK because 100 = 4*25 is not a prime.
5 = 101_2 is OK because 101 is a prime.
7 = 111_2 is not OK because 111 = 3*37.
11 = 1011_2 is not OK because 1011 = 3*337.
313 = 100111001_2 is OK because 100111001 is prime.
		

Crossrefs

Programs

  • Maple
    A007088 := proc(n)
    dgs := convert(n,base,2) ;
    add(op(i,dgs)*10^(i-1),i=1..nops(dgs)) ;
    end proc:
    isA036952 := proc(n)
    isprime( A007088(n)) :
    end proc:
    A036952 := proc(n)
    if n =1 then
    3;
    else
    for a from procname(n-1)+1 do
    if isA036952(a) then
    return a ;
    end if;
    end do:
    end if;
    end proc:
    seq(A036952(n),n=1..80) ;
    # R. J. Mathar, Mar 12 2010
    A036952 := proc() if isprime(convert(n,binary)) then RETURN (n); fi; end: seq(A036952(), n=1..1000);  # K. D. Bajpai, Jul 04 2014
  • Mathematica
    f[n_,k_]:=FromDigits[IntegerDigits[n,k]];lst={};Do[If[PrimeQ[f[n,2]],AppendTo[lst,n]],{n,7!}];lst (* Vladimir Joseph Stephan Orlovsky, Mar 12 2010 *)
    NestList[NestWhile[# + 2 &, #, ! PrimeQ[FromDigits[IntegerDigits[#2, 2]]] &, 2] &, 3, 52] (* Jan Mangaldan, Jul 02 2020 *)
  • PARI
    is(n)=my(v=binary(n));isprime(sum(i=1,#v,v[i]*10^(#v-i))) \\ Charles R Greathouse IV, Jun 28 2013

Extensions

Entry revised by R. J. Mathar and N. J. A. Sloane, Mar 12 2010

A020472 Primes that contain digits 8 and 9 only.

Original entry on oeis.org

89, 8999, 89899, 89989, 98899, 98999, 99989, 888989, 898889, 989999, 998989, 8888989, 8889889, 8988989, 8989999, 8998889, 8999899, 9888889, 9889889, 9899999, 9989899, 9999889, 88888999, 88898989, 88989899, 89888989, 89889889, 89898889, 89999999, 98888989
Offset: 1

Views

Author

Keywords

Comments

Or, primes with minimal digit 8.

Crossrefs

Cf. A020449 (digits 0 & 1), ..., A020471 (digits 7 & 9). - M. F. Hasler, Mar 18 2010

Programs

  • Mathematica
    Select[Prime[Range[80000]], Min[IntegerDigits[#]] == 8 &] (* Zak Seidov, May 07 2005 *)
    Flatten[Table[Select[FromDigits/@Tuples[{8, 9}, n], PrimeQ], {n, 8}]] (* Vincenzo Librandi, Jul 27 2012 *)
  • PARI
    for(nd=1,9, p=vector(nd,i,10^(nd-i))~; forvec(v=vector(nd,i,[8+(i==nd),9]), isprime(v*p) && print1(v*p","))) \\ M. F. Hasler, Mar 18 2010
    
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def agen(): # generator of terms
        for d in count(2):
            for first in product("89", repeat=d-1):
                t = int("".join(first) + "9")
                if isprime(t): yield t
    print(list(islice(agen(), 30))) # Michael S. Branicky, Nov 15 2022

Extensions

Edited by N. J. A. Sloane, Jan 26 2008 at the suggestion of Lekraj Beedassy

A199325 Primes having only {0, 1, 5} as digits.

Original entry on oeis.org

5, 11, 101, 151, 1051, 1151, 1511, 5011, 5051, 5101, 5501, 10111, 10151, 10501, 11551, 15101, 15511, 15551, 50051, 50101, 50111, 50551, 51001, 51151, 51511, 51551, 55001, 55051, 55501, 55511, 100151, 100501, 100511, 101051, 101111, 101501, 110051, 110501, 115001, 115151, 150001, 150011, 150151, 150551
Offset: 1

Views

Author

M. F. Hasler, Nov 05 2011

Keywords

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(160000) | Set(Intseq(p)) subset [0, 1, 5]]; // Vincenzo Librandi, Apr 22 2014
  • Maple
    N:= 10000: # to get the first N terms
    count:= 0:
    allowed:= {0,1,5}:
    nallowed:= nops(allowed):
    subst:= seq(i=allowed[i+1],i=0..nallowed-1):
    for d from 0 while count < N do
      for x1 from 1 to nallowed-1 while count < N do
        for t from 0 to nallowed^d-1 while count < N do
          L:= subs(subst,convert(x1*nallowed^d+t,base,nallowed));
          X:= add(L[i]*10^(i-1),i=1..d+1);
          if isprime(X) then
              count:= count+1;
              A[count]:= X;
          fi
    od od od:
    seq(A[n],n=1..N); # Robert Israel, Apr 20 2014
  • Mathematica
    Select[FromDigits/@Tuples[{0,1,5},6],PrimeQ] (* Harvey P. Dale, Jul 23 2021 *)
  • PARI
    L=[0,1,5];for(d=1,6,u=vector(d,i,10^(d-i))~;forvec(v=vector(d,i,[1+(i==1 & !L[1]),#L]),ispseudoprime(t=vector(d,i,L[v[i]])*u)&print1(t",")))  /* see A199327 for a function a(n) */
    

A199329 Primes having only {0, 1, 9} as digits.

Original entry on oeis.org

11, 19, 101, 109, 191, 199, 911, 919, 991, 1009, 1019, 1091, 1109, 1901, 1999, 9001, 9011, 9091, 9109, 9199, 9901, 10009, 10091, 10099, 10111, 10909, 11119, 11909, 19001, 19009, 19919, 19991, 90001, 90011, 90019, 90191, 90199, 90901, 90911, 91009, 91019, 91099, 91199, 91909, 99109, 99119, 99191, 99901, 99991
Offset: 1

Views

Author

M. F. Hasler, Nov 05 2011

Keywords

Crossrefs

Programs

  • Mathematica
    Select[FromDigits/@Tuples[{0,1,9},5],PrimeQ] (* Harvey P. Dale, Dec 10 2016 *)
  • PARI
    A199329(n=50,show=0,L=[0,1,9])={for(d=1,1e9,my(t,u=vector(d,i,10^(d-i))~);forvec(v=vector(d,i,[1+!(L[1]||(i>1&&iM. F. Hasler, Jul 25 2015

A235615 Primes whose base-5 representation also is the base-4 representation of a prime.

Original entry on oeis.org

2, 3, 13, 41, 43, 61, 181, 191, 263, 281, 283, 331, 383, 431, 443, 463, 641, 643, 661, 881, 911, 1063, 1091, 1291, 1303, 1531, 1693, 2083, 2143, 2203, 2293, 2341, 3163, 3181, 3191, 3253, 3343, 3593, 3761, 3931, 4001, 4093, 4391, 4691, 4793, 5011, 5393, 5413, 5441, 6301
Offset: 1

Views

Author

M. F. Hasler, Jan 13 2014

Keywords

Comments

This sequence is part of the two-dimensional array of sequences based on this same idea for any two different bases b, c > 1. Sequence A235265 and A235266 are the most elementary ones in this list. Sequences A089971, A089981 and A090707 through A090721, and sequences A065720 - A065727, follow the same idea with one base equal to 10.

Examples

			Both 13 = 23_5 and 23_4 = 11 are prime.
		

Crossrefs

Cf. A235474, A235265, A235266, A152079, A235461 - A235482, A065720 - A065727, A235394, A235395, A089971A020449, A089981, A090707 - A091924, A235615 - A235639. See the LINK for further cross-references.

Programs

  • PARI
    is(p,b=4,c=5)=vecmax(d=digits(p,c))
    				
  • PARI
    forprime(p=1,3e3,is(p,5,4)&&print1(vector(#d=digits(p,4),i,5^(#d-i))*d~,",")) \\ To produce the terms, this is more efficient than to select them using straightforwardly is(.)=is(.,4,5)
Showing 1-10 of 128 results. Next