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

A228768 Smallest number that is an emirp in all bases from 2 through n.

Original entry on oeis.org

11, 11, 53, 61, 193, 193, 193, 193, 93836531, 1963209431, 14322793967831, 14322793967831
Offset: 2

Views

Author

James G. Merickel, Sep 03 2013

Keywords

Comments

Note: This sequence would differ almost certainly only in a few smaller terms if (multi-digit) palindromes were also allowed or, in the other direction, if the emirp partners were required to all differ from each other.
Numbers in this sequence must lie in specific ranges wherein the leading digit in each composite base is relatively prime to the base. In particular, if a value is to be found that is emirp in bases 2 through 14, its leading digits in bases 4, 6, 8, 9, 10, 12 and 14 are limited to 2/3, 2/5, 4/7, 6/8 (=3/4), 4/9, 4/11 and 6/13 of the possibilities.
With searches limited to such ranges, a probability estimate -- based on the Prime Number Theorem -- that a prime number is an emirp is enhanced by a factor expressing knowledge of non-divisibility by the prime divisors of the base and also by the prime factors of the base minus and plus 1. For example, for base 10 the knowledge that a number's reversal is prime and leads with a permissible digit implies that the number itself is not divisible by 2, 3, 5 or 11; and a factor of 2*(3/2)*(5/4)*(11/10)=33/8 would properly be multiplied by the reciprocal of the logarithm of the number to approximate the chance that the number is prime.
For the base-14 problem, employing a small (number-dependent) constant c to account for ratios of a number to its different-base reversals and multiplying such factors together provides an overall estimate of (3^5 * 5^4 * 7^5 * 11^3 * 13^3)/(2^28*(log(P)+c)^13) that a large prime, P, with permissible leading digits is an emirp in bases 2 through 14. The rational multiplier is about 27806397.37 or 3.7378900 per base. With calculations based on this way of employing standard heuristics, it turns out that this next term is most likely in the 3rd permissible range, between 5*6^20 and 2*10^16. (The 1st and 2nd are (a(13), 6*9^13) and (3*8^15, 2*14^12), respectively.) But there is an appreciable chance of its arising before that (greater than 10%), and also a not ignorable possibility (3 to 4%) it cannot be found until the 4th range (between 9*14^15 and 8*12^16, the chances being microscopic of this failing). Thus, either luck or excessive use of resources is required.

Examples

			Decimal 193 is 11000001, 21011, 3001, 1233, 521, 364, 301 and 234 in bases 2 through 9, and reversing (and translating back to decimal from these bases) gives primes 131, 113, 67, 461, 53, 241, 67 and 353.
		

Crossrefs

Programs

  • PARI
    emirp(p,b)=my(q,t=p);while(t,q=b*q+t%b;t\=b);isprime(q) && p!=q
    a(n)=forprime(p=2,,for(b=2,n,if(!emirp(p,b),next(2))); return(p)) \\ Charles R Greathouse IV, Sep 03 2013
    
  • Python
    from gmpy2 import is_prime, next_prime
    def isemirp(n,b=10): # check if n is emirp in base b
        x, y = n, 0
        while x >= b:
            x, r = divmod(x,b)
            y = y*b + r
        y = y*b + x
        return n != y and is_prime(y)
    def A228768(n):
        m = 1
        while True:
            m = next_prime(m)
            for b in range(2,n+1):
                if not isemirp(m,b):
                    break
            else:
                return m # Chai Wah Wu, Jun 11 2015

A331486 Numbers k which are emirps in more bases 1 < b < k than any previous number.

Original entry on oeis.org

2, 5, 7, 11, 13, 17, 23, 29, 31, 41, 43, 53, 67, 73, 79, 97, 113, 127, 157, 193, 223, 269, 277, 311, 379, 421, 431, 467, 487, 563, 613, 647, 743, 907, 937, 977, 1093, 1193, 1249, 1259, 1373, 1483, 1543, 1637, 1667, 1933, 2239, 2393, 2477, 2521, 2857, 2957, 3083
Offset: 1

Views

Author

Amiram Eldar, Jan 23 2020

Keywords

Comments

The corresponding numbers of bases are 0, 1, 3, 6, 8, 9, 12, 13, 17, 21, 24, ... (see the link for more values).

Examples

			2 is not emirp in any base.
5 is emirp in one base, 3: 5 is 12 in base 3, and 21 in base 3 is 7 which is also a prime.
7 is emirp in 3 bases, 3, 4, and 5.
		

Crossrefs

Programs

  • Mathematica
    emirpQ[n_, b_] := n != (rev = FromDigits[Reverse @ IntegerDigits[n, b], b]) && And @@ PrimeQ[{n, rev}];
    emirpCount[n_] := Length @ Select[Range[2, n - 1], emirpQ[n, #] &];
    seq = {}; emax = -1; Do[e1 = emirpCount[n]; If[e1 > emax, emax = e1; AppendTo[seq, n]], {n, 2, 3000}]; seq

A333422 Factorial base emirps: prime numbers whose factorial base reversal is a different prime.

Original entry on oeis.org

29, 37, 137, 181, 733, 743, 769, 977, 1013, 1031, 1033, 1049, 5107, 5119, 5171, 5179, 5233, 5273, 5297, 5323, 5387, 5393, 5399, 5407, 5437, 5441, 5449, 5471, 5477, 5483, 6571, 6607, 6689, 6691, 6709, 6719, 6733, 6763, 6803, 6823, 6829, 6907, 6947, 6949, 40343
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2020

Keywords

Examples

			29 is a term since it is a prime number and its representation in factorial base is 1021, whose reversal, 1201, is the factorial base representation of another prime number, 37.
		

Crossrefs

Programs

  • Mathematica
    max = 8; bases = Range[max, 2, -1]; nmax = max! - 1; emirpQ[n_] := PrimeQ[n] && Module[{d = IntegerDigits[n, MixedRadix[bases]]}, r = Reverse @ d; IntegerDigits[(m = FromDigits[r, MixedRadix[bases]]), MixedRadix[bases]] == r && m != n && PrimeQ[m]]; Select[Range[nmax], emirpQ]

A333425 Primorial base emirps: prime numbers whose primorial base reversal is a different prime.

Original entry on oeis.org

227, 283, 2339, 2351, 2357, 2393, 2767, 2777, 2789, 2797, 2801, 2833, 2851, 2861, 30059, 30089, 30161, 30169, 30187, 30197, 30223, 30293, 30313, 30319, 30389, 30391, 30449, 30467, 30509, 30517, 30559, 30631, 30649, 30677, 30689, 30727, 30763, 30781, 30803, 30851
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2020

Keywords

Examples

			227 is a term since it is a prime number and its representation in primorial base is 10221, whose reversal, 12201, is the primorial base representation of another prime number, 283.
		

Crossrefs

Programs

  • Mathematica
    max = 7; bases = Prime @ Range[max, 1, -1]; nmax = Times @@ bases - 1; emirpQ[n_] := PrimeQ[n] && Module[{d = IntegerDigits[n, MixedRadix[bases]]}, r = Reverse @ d; IntegerDigits[(m = FromDigits[r, MixedRadix[bases]]), MixedRadix[bases]] == r && m != n && PrimeQ[m]]; Select[Range[nmax], emirpQ]

A347209 Emirps in both base 2 and base 10.

Original entry on oeis.org

13, 37, 71, 97, 113, 167, 199, 337, 359, 701, 709, 739, 907, 937, 941, 953, 967, 1033, 1091, 1109, 1153, 1181, 1201, 1217, 1229, 1259, 1439, 1471, 1487, 1669, 1733, 1789, 1811, 1933, 1949, 3019, 3067, 3083, 3089, 3121, 3163, 3221, 3299, 3343, 3389, 3433, 3469, 3511, 3527, 3571, 3583, 3643, 3719
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Aug 23 2021

Keywords

Comments

Primes p such that A030101(p) and A004086(p) are primes other than p.
Are there any cases where A030101(p) = A004086(p), i.e. emirps in A081434?

Examples

			a(3) = 71 is a term because 71 is prime, its base-10 reversal 17 is a prime other than 71, and its base-2 reversal 113 is a prime other than 71.
		

Crossrefs

Intersection of A006567 and A080790.
Subset of A136634.

Programs

  • Maple
    filter:= proc(n) local L,nL,i,r,s;
      if not isprime(n) then return false fi;
      L:= convert(n,base,10);
      nL:= nops(L);
      r:= add(10^(nL-i)*L[i],i=1..nL);
      if r=n or not isprime(r) then return false fi;
      L:= convert(n,base,2);
      nL:= nops(L);
      s:=add(2^(nL-i)*L[i],i=1..nL);
      s <> n and isprime(s)
    end proc:
    select(filter, [seq(i,i=3..10000,2)]);
  • Mathematica
    Select[Range[4000], (ir = IntegerReverse[#]) != # && PrimeQ[#] && PrimeQ[ir] && (ir2 = IntegerReverse[#, 2]) != # && PrimeQ[ir2] &] (* Amiram Eldar, Aug 23 2021 *)
    Select[Prime[Range[600]],!PalindromeQ[#]&&FromDigits[Reverse[IntegerDigits[#,2]],2]!=#&&AllTrue[{IntegerReverse[#],FromDigits[Reverse[IntegerDigits[#,2]],2]},PrimeQ]&] (* Harvey P. Dale, Oct 13 2022 *)
  • Python
    from sympy import isprime, primerange
    def ok(p):
        s, b = str(p), bin(p)[2:]
        if s == s[::-1] or b == b[::-1]: return False
        return isprime(int(s[::-1])) and isprime(int(b[::-1], 2))
    print(list(filter(ok, primerange(1, 3720)))) # Michael S. Branicky, Aug 24 2021

A377421 Numbers whose binary reversal is prime and unequal to the original number.

Original entry on oeis.org

6, 10, 11, 12, 13, 14, 20, 22, 23, 24, 25, 26, 28, 29, 34, 37, 40, 41, 43, 44, 46, 47, 48, 50, 52, 53, 55, 56, 58, 61, 62, 67, 68, 71, 74, 77, 80, 82, 83, 86, 88, 91, 92, 94, 96, 97, 100, 101, 104, 106, 110, 112, 113, 115, 116, 121, 122, 124, 131, 134, 136, 142
Offset: 1

Views

Author

Simon R Blow, Oct 27 2024

Keywords

Comments

Contains A080790 and p*2^i for all primes p in A074832 union A080790 and i > 0. - Michael S. Branicky, Oct 29 2024

Examples

			6 = 110_2 is a term since reversed it is 011_2 = 3 which is prime.
7 = 111_2 is not a term since base 2 palindromic numbers are not included.
		

Crossrefs

Supersequence of A080790.

Programs

  • Mathematica
    Select[Range[142],PrimeQ[r=FromDigits[Reverse[IntegerDigits[#,2]],2]]&&r!=#&] (* James C. McMahon, Nov 18 2024 *)
  • Python
    from sympy import isprime
    def ok(n): return (b:=bin(n)[2:]) != (br:=b[::-1]) and isprime(int(br, 2))
    print([k for k in range(1, 143) if ok(k)]) # Michael S. Branicky, Oct 28 2024
    
  • Python
    # alternate program constructing terms directly from primes
    from sympy import primerange
    def auptobits(maxbits):
        alst = []
        for p in primerange(3, 1<Michael S. Branicky, Oct 29 2024

Formula

a = A204232 - A006995 (as sets). - Michael S. Branicky, Oct 29 2024
Showing 1-6 of 6 results.