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 10 results.

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

Original entry on oeis.org

2, 7, 11, 13, 41, 47, 67, 73, 79, 109, 127, 151, 173, 181, 191, 193, 211, 223, 227, 229, 233, 251, 283, 331, 367, 421, 443, 487, 541, 557, 563, 587, 601, 607, 631, 641, 661, 677, 719, 733, 877, 941, 947, 967, 971, 1033, 1187, 1193, 1201, 1301, 1321, 1373, 1447, 1451, 1471, 1531, 1567, 1571, 1657, 1667, 1669, 1697, 1709, 1759
Offset: 1

Views

Author

M. F. Hasler, Jan 05 2014

Keywords

Crossrefs

Cf. A090707 - A091924, A235461 - A235482. See the LINK for further cross-references.

Programs

  • Maple
    f:= proc(n) local L,i;
      L:= convert(n,base,2);
      isprime(add(L[i]*3^(i-1),i=1..nops(L)))
    end proc:
    select(f, [seq(ithprime(i),i=1..1000)]); # Robert Israel, Jun 03 2019
  • Mathematica
    Select[Prime@ Range@ 250, PrimeQ@ FromDigits[IntegerDigits[#, 2], 3] &] (* Michael De Vlieger, Jun 03 2019 *)
  • PARI
    is(p,b=3,c=2)=isprime(vector(#d=digits(p,c),i,b^(#d-i))*d~)&&isprime(p) \\ This code can be used for other bases b,c when b>c. See A235265 for code valid for b
    				
  • PARI
    forprime(p=2, 1e3, if(isprime(fromdigits(binary(p), 3)), print1(p", "))) \\ Charles R Greathouse IV, Mar 28 2022
    
  • 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 p
            p = nextprime(p)
    g = agen()
    print([next(g) for n in range(1, 65)]) # Michael S. Branicky, Jan 16 2022

Formula

a(n) is the number whose base-3 representation is the base-2 representation of A235265(n).

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

A077718 Primes which can be expressed as sum of distinct powers of 4.

Original entry on oeis.org

5, 17, 257, 277, 337, 1093, 1109, 1297, 1301, 1361, 4177, 4357, 4373, 4421, 5189, 5381, 5393, 5441, 16453, 16657, 16661, 17477, 17489, 17669, 17681, 17729, 17749, 20549, 20753, 21521, 21569, 21589, 21841, 65537, 65557, 65617, 65809, 66629
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

Primes whose base 4 representation contains only zeros and 1's.
As a subsequence of primes in A000695, these could be called Moser-de Bruijn primes. See also A235461 for those terms whose base 4 representation also represents a prime in base 2. - M. F. Hasler, Jan 11 2014

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,x;
      L:= convert(n,base,2);
      x:= 1+add(L[i]*4^i,i=1..nops(L));
      if isprime(x) then x fi
    end proc:
    map(f, [$1..1000]); # Robert Israel, Sep 06 2018
  • Mathematica
    Select[Prime[Range[6650]],Max[IntegerDigits[#,4]]<=1&] (* Jayanta Basu, May 22 2013 *)
  • PARI
    for(i=1,999,isprime(b=vector(#b=binary(i),j,4^(#b-j))*b~)&&print1(b",")) \\ - M. F. Hasler, Jan 12 2014

Extensions

More terms from Sascha Kurz, Jan 03 2003

A077722 Primes which can be expressed as sums of distinct powers of 8.

Original entry on oeis.org

73, 521, 577, 4673, 32833, 33289, 33353, 36929, 37441, 262153, 262217, 262657, 295433, 299017, 299521, 2097673, 2101249, 2101313, 2134529, 2359369, 2359873, 2363393, 2363401, 2392073, 16777289, 16777729, 16810049, 16810561, 16814089
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

Primes whose base 8 representations contain only 0's and 1's.
Intersection of A000040 and A033045. - Michel Marcus, Sep 14 2013

Crossrefs

Programs

  • PARI
    isok(n) = {digs = digits(n, 8); for (i = 1, #digs, if (digs[i] > 1, return (0));); return (1);}
    lista(nn) = {forprime (p=1, nn, if (isok(p), print1(p, ", ");););} \\ Michel Marcus, Sep 14 2013
    
  • PARI
    forstep(n=7,999,2,t=fromdigits(binary(n),8); if(isprime(t), print1(t", "))) \\ Charles R Greathouse IV, Jun 08 2015

Extensions

More terms from Francois Jooste (phukraut(AT)hotmail.com), Dec 23 2002

A077720 Primes which can be expressed as sum of distinct powers of 6.

Original entry on oeis.org

7, 37, 43, 223, 1297, 1303, 1549, 7993, 9109, 46663, 54469, 55987, 281233, 326593, 327889, 335917, 1679653, 1679659, 1679833, 1680919, 1681129, 1687393, 1726273, 1726489, 1727569, 1727827, 1734049, 1960891, 1961107, 1967587, 2006461
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

Primes whose base 6 representation contains only zeros and 1's.

Crossrefs

Programs

  • Mathematica
    Select[FromDigits[#,6]&/@Tuples[{0,1},9],PrimeQ] (* Harvey P. Dale, May 01 2018 *)

Extensions

More terms from Sascha Kurz, Jan 03 2003

A077721 Primes which can be expressed as sum of distinct powers of 7.

Original entry on oeis.org

7, 2801, 17207, 19559, 120401, 134513, 134807, 137201, 840743, 842759, 842801, 941249, 943601, 958007, 958049, 958343, 960793, 5782001, 5784409, 5899307, 5899601, 5899657, 5901659, 6591089, 6607903, 6706393, 6708787, 6722801, 6722857, 6723193
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

Primes whose base 7 representation contains only zeros and 1's.

Crossrefs

Programs

  • Maple
    pos := 0:for i from 1 to 4000 do b := convert(i,base,2); s := sum(b[j]*7^(j-1),j=1..nops(b)): if(isprime(s)) then pos := pos+1:a[pos] := s:fi: od:seq(a[j],j=1..pos);
  • Mathematica
    Select[Prime[Range[10^6]], Max[IntegerDigits[#, 7]]<=1 &] (* Vincenzo Librandi, Sep 07 2018 *)

Extensions

More terms from Sascha Kurz, Jan 03 2003

A077719 Primes which can be expressed as sum of distinct powers of 5.

Original entry on oeis.org

5, 31, 131, 151, 631, 751, 3251, 3881, 16381, 19381, 19501, 19531, 78781, 78901, 81281, 81401, 81901, 82031, 93901, 94531, 97001, 97501, 97651, 390751, 390781, 393901, 394501, 406381, 468781, 469501, 471901, 472631, 484531, 485131, 487651, 1953151, 1953901
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

Primes whose base 5 representation contains only zeros and 1's.

Crossrefs

Programs

  • Python
    from sympy import isprime
    def aupton(terms):
      k, alst = 0, []
      while len(alst) < terms:
        k += 1
        t = sum(5**i*int(di) for i, di in enumerate((bin(k)[2:])[::-1]))
        if isprime(t): alst.append(t)
      return alst
    print(aupton(37)) # Michael S. Branicky, May 31 2021

Extensions

More terms from Sascha Kurz, Jan 03 2003
a(36) and beyond from Michael S. Branicky, May 31 2021

A077723 Primes which can be expressed as sum of distinct powers of 9.

Original entry on oeis.org

739, 811, 6571, 59779, 65701, 532261, 538093, 591301, 597133, 597781, 4783699, 4789621, 4842109, 4849399, 5314411, 5314501, 5373469, 5374279, 5380831, 43047541, 43112341, 43113061, 43643773, 43643863, 47837071, 47888821
Offset: 1

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

Primes whose base 9 representation contains only zeros and 1's.

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[3000000]],Union[Most[Rest[DigitCount[#,9]]]]=={0}&] (* Harvey P. Dale, Jul 31 2013 *)
  • PARI
    lista(nn) = {forprime(p=2, nn, if (vecmax(digits(p, 9)) <= 1, print1(p, ", ")););} \\ Michel Marcus, Oct 10 2014

Extensions

More terms from Sascha Kurz, Jan 03 2003

A082555 Primes whose base-3 representation does not contain a 0.

Original entry on oeis.org

2, 5, 7, 13, 17, 23, 41, 43, 53, 67, 71, 79, 131, 149, 151, 157, 211, 229, 233, 239, 241, 367, 373, 401, 449, 457, 607, 617, 619, 643, 647, 691, 701, 719, 727, 1093, 1097, 1103, 1123, 1129, 1187, 1201, 1213, 1367, 1373, 1427, 1429, 1447, 1453, 1823, 1831, 1861
Offset: 1

Views

Author

Randy L. Ekl, May 03 2003

Keywords

Comments

Primes in A032924. - Robert Israel, Dec 28 2018
The analog "primes without digit 2 in ternary" is A077717. There is no prime > 2 not having the digit 1 in ternary, since then the number is divisible by 2. - M. F. Hasler, Feb 15 2023

Examples

			41 = 1112_3, which contains no 0.
		

Crossrefs

Cf. A032924 (numbers without digit 0 in base 3), A073779, A077267.
Cf. A077717 (primes that are the sum of distinct powers of 3 <=> base-3 representation does not contain a digit 2).

Programs

  • Maple
    select(t -> isprime(t) and not(has(convert(t,base,3),0)), [2,seq(i,i=5..10000,2)]); # Robert Israel, Dec 28 2018
  • PARI
    dec3(s)=while(s>0,if(s%3==0,return(0),s=floor(s/3))); return(1)
    forprime(i=1,20000,if(dec3(i)==1,print1(i,", "),))
    
  • Python
    def is_A082555(n): return is_A032924(n) and A010051(n)
    [p for p in range(1888) if is_A082555(p)] # M. F. Hasler, Feb 15 2023

A077724 a(n) = smallest prime which can be expressed as a sum of distinct powers of n.

Original entry on oeis.org

2, 3, 5, 5, 7, 7, 73, 739, 11, 11, 13, 13, 197, 241, 17, 17, 19, 19, 401, 463, 23, 23, 577, 10171901, 677, 757, 29, 29, 31, 31, 32801, 1123, 1336337, 44101, 37, 37, 1483, 59359, 41, 41, 43, 43, 85229, 93151, 47, 47, 110641, 13847169701, 2551, 345157903, 53, 53
Offset: 2

Views

Author

Amarnath Murthy, Nov 19 2002

Keywords

Comments

a(n) = smallest prime whose base n representation contains only zeros and 1's.
Values of n at which a(n) reach record values are: 2, 3, 4, 6, 8, 9, 25, 49, 91, 121, 187, 201, 301, 721, 799, 841... Notably, many of them are squares of primes. - Ivan Neretin, Sep 20 2017

Crossrefs

Programs

  • Mathematica
    Table[i = p = 1; While[! PrimeQ[p], p = FromDigits[IntegerDigits[i++, 2], n]]; p, {n, 2, 53}] (* Ivan Neretin, Sep 20 2017 *)
  • Python
    from itertools import count
    from sympy import isprime
    def A077724(n): return next(filter(isprime,(sum(n**i for i, j in enumerate(bin(m)[-1:1:-1]) if j=='1') for m in count(1)))) # Chai Wah Wu, Apr 04 2025

Extensions

More terms from Sascha Kurz, Jan 03 2003
Showing 1-10 of 10 results.