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 19 results. Next

A006567 Emirps (primes whose reversal is a different prime).

Original entry on oeis.org

13, 17, 31, 37, 71, 73, 79, 97, 107, 113, 149, 157, 167, 179, 199, 311, 337, 347, 359, 389, 701, 709, 733, 739, 743, 751, 761, 769, 907, 937, 941, 953, 967, 971, 983, 991, 1009, 1021, 1031, 1033, 1061, 1069, 1091, 1097, 1103, 1109, 1151, 1153, 1181, 1193, 1201
Offset: 1

Views

Author

Keywords

Comments

A palindrome is a word that when written in reverse results in the same word. for example, "racecar" reversed is still "racecar". Related to palindromes are semordnilaps. These are words that when written in reverse result in a distinct valid word. For example, "stressed" written in reverse is "desserts". Not all words are palindromes or semordnilaps. While certainly not all numbers are palindromes, all non-palindromic numbers when written in reverse will form semordnilaps. Narrowing to primes brings back the same trichotomy as with words: some numbers are emirps, some numbers are palindromic primes, but some words are neither.
The term "emirp" was coined by the American mathematician Jeremiah Farrell (1937-2022). - Amiram Eldar, Jun 11 2021

References

  • Martin Gardner, The Magic Numbers of Dr Matrix. Prometheus, Buffalo, NY, 1985, p. 230.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A003684, A007628 (subsequence), A046732, A048051, A048052, A048053, A048054, A048895, A004086 (read n backwards).
A007500 is the union of A002385 and this sequence.

Programs

  • Haskell
    a006567 n = a006567_list !! (n-1)
    a006567_list = filter f a000040_list where
       f p = a010051' q == 1 && q /= p  where q = a004086 p
    -- Reinhard Zumkeller, Jul 16 2014
    
  • Magma
    [ n : n in [1..1194] | n ne rev and IsPrime(n) and IsPrime(rev) where rev is Seqint(Reverse(Intseq(n))) ]; // Sergei Haller (sergei(AT)sergei-haller.de), Dec 21 2006
    
  • Maple
    read("transforms") ; isA006567 := proc(n) local R ; if isprime(n) then R := digrev(n) ; isprime(R) and R <> n ; else false; end if; end proc:
    A006567 := proc(n) option remember ; local a; if n = 1 then 13; else a := nextprime(procname(n-1)) ; while not isA006567(a) do a := nextprime(a) ; end do; return a; end if; end proc:
    seq(A006567(n),n=1..120) ; # R. J. Mathar, May 24 2010
  • Mathematica
    fQ[n_] := Block[{idn = IntegerReverse@ n}, PrimeQ@ idn && n != idn]; Select[Prime@ Range@ 200, fQ] (* Santi Spadaro, Oct 14 2001 and modified by Robert G. Wilson v, Nov 08 2015 *)
    Select[Prime[Range[5,200]],PrimeQ[IntegerReverse[#]]&&!PalindromeQ[#]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 11 2021 *)
  • PARI
    is(n)=my(r=eval(concat(Vecrev(Str(n)))));isprime(r)&&r!=n&&isprime(n) \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    select( {is_A006567(n,r=fromdigits(Vecrev(digits(n))))=isprime(r)&&r!=n&&isprime(n)}, primes(200)) \\ M. F. Hasler, Jan 31 2020
    
  • Python
    from sympy import prime, isprime
    A006567 = [p for p in (prime(n) for n in range(1,10**6)) if str(p) != str(p)[::-1] and isprime(int(str(p)[::-1]))] # Chai Wah Wu, Aug 14 2014
    
  • Python
    from sympy import isprime, nextprime
    def emirps(start=1, end=float('inf')): # generator for emirps in start..end
        p = nextprime(start-1)
        while p <= end:
            s = str(p)
            if s[0] in "24568":
                p = nextprime((int(s[0])+1)*10**(len(s)-1)); continue
            revp = int(s[::-1])
            if p != revp and isprime(revp): yield p
            p = nextprime(p)
    print(list(emirps(end=1201))) # Michael S. Branicky, Jan 24 2021, updated Jul 28 2022

Extensions

More terms from James Sellers, Jan 22 2000

A048054 Number of n-digit reversible primes (emirps).

Original entry on oeis.org

4, 9, 43, 204, 1499, 9538, 71142, 535578, 4197196, 33619380, 274932272, 2294771254, 19489886063, 167630912672, 1456476399463
Offset: 1

Views

Author

Keywords

Comments

The count includes palindromes.

Examples

			2, 3, 5 and 7 are 1-digit reversible primes, so a(1)=4.
		

Crossrefs

Programs

  • Mathematica
    Count[Range[10^(# - 1), 10^# - 1], n_ /; And[PrimeQ@ n, PrimeQ@ FromDigits@ Reverse@ IntegerDigits@ n]] & /@ Range@ 7 (* Michael De Vlieger, Jul 14 2015 *)
  • Python
    from sympy import isprime, primerange
    def A048054(n):
        return len([p for p in primerange(10**(n-1),10**n)
                    if isprime(int(str(p)[::-1]))]) # Chai Wah Wu, Aug 14 2014

Extensions

a(11)-a(13) from Giovanni Resta, Jul 19 2015
a(14)-a(15) from Cécile Dartyge, Bruno Martin, Joël Rivat, Igor E. Shparlinski, and Cathy Swaenepoel, Oct 05 2023

A048052 Start of the first occurrence of n consecutive reversible primes (emirps).

Original entry on oeis.org

2, 2, 2, 2, 2, 2, 2, 727, 1193, 1193, 1477271183, 9387802769, 15423094826093
Offset: 1

Views

Author

Keywords

Comments

Palindromic primes are allowed.

Examples

			2, 3, 5, 7, 11, 13 and 17 are consecutive reversible primes, so a(7) = 2.
		

Crossrefs

Cf. A040104 (n=10), A048051 (n=11), A048053 (n=12), A003684, A006567, A007628, A046732, A048054, A048895.

Extensions

Corrected by Rick L. Shepherd, May 28 2002
a(13) from Giovanni Resta, Nov 07 2019

A048895 Bemirps: primes that yield a different prime when turned upside down with reversals of both being two more different primes.

Original entry on oeis.org

1061, 1091, 1601, 1901, 10061, 10091, 16001, 19001, 106861, 109891, 168601, 198901, 1106881, 1109881, 1606081, 1806061, 1809091, 1886011, 1889011, 1909081, 10806881, 10809881, 11061811, 11091811, 11609681, 11698691, 11816011, 11819011, 11906981
Offset: 1

Views

Author

Keywords

Comments

Emirps that yield other emirps when turned upside down. - Lekraj Beedassy, Apr 03 2009
Invertible primes whose reversals are also invertible primes. - Lekraj Beedassy, Apr 04 2009
All terms must begin and end with a one. - T. D. Noe, Apr 21 2014
A term has to include 6 or 9. The concatenation of first n = 809 bemirp 10611091...11688981911 is a prime with 8143 digits being the smallest one for n > 1. There isn't a bemirp < 10^15 with a bemirp index (over all primes). Bemirps such that 4 associated primes are all Sophie Germain primes are 1161880189181, 1191880186181, 1819810881611, 1816810881911, ... . - Metin Sariyar, Mar 06 2020

Crossrefs

Programs

  • Mathematica
    upDown[0] = 0; upDown[1] = 1; upDown[6] = 9; upDown[8] = 8; upDown[9] = 6; fQ[p_] := Module[{revP, upDownP, revUpDownP}, If[Intersection[{2, 3, 4, 5, 7}, Union[IntegerDigits[p]]] != {}, False, revP = FromDigits[Reverse[IntegerDigits[p]]]; upDownP = FromDigits[upDown /@ IntegerDigits[p]]; revUpDownP = FromDigits[Reverse[IntegerDigits[upDownP]]]; p != revP && p != upDownP && p != revUpDownP && PrimeQ[revP] && PrimeQ[upDownP] && PrimeQ[revUpDownP]]]; t = {}; nn = 6; Do[p = 10^n; While[p < 2*10^n, p = NextPrime[p]; If[fQ[p], AppendTo[t, p]]], {n, nn}]; t (* T. D. Noe, Apr 21 2014 *)

Extensions

More terms from David W. Wilson

A046732 "Norep emirps": primes with distinct digits which remain prime when reversed.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 31, 37, 71, 73, 79, 97, 107, 149, 157, 167, 179, 347, 359, 389, 701, 709, 739, 743, 751, 761, 769, 907, 937, 941, 953, 967, 971, 983, 1069, 1097, 1237, 1249, 1259, 1279, 1283, 1409, 1429, 1439, 1453, 1487, 1523, 1583, 1597, 1657, 1723, 1753
Offset: 1

Views

Author

Keywords

Comments

There are no 10-digit terms because their sum of digits would be 45 and thus the number would be divisible by 3.
There are 25332 terms in this sequence, the last of which is 987653201, as found by Harvey P. Dale. - see Martin Gardner's column in Scientific American.

Crossrefs

Programs

  • Maple
    read(transforms): A046732 := proc(n) option remember: local d,k,p,distdig: if(n=1)then return 2: fi: p:=procname(n-1): do p:=nextprime(p): if(isprime(digrev(p)))then d:=convert(p,base,10): distdig:=true: for k from 0 to 9 do if(numboccur(d,k)>1)then distdig:=false: break: fi: od: if(distdig)then return p: fi: fi: od: end: seq(A046732(n),n=1..52); # Nathaniel Johnston, May 29 2011
  • Mathematica
    Select[Prime[Range[280]], Length[Union[x = IntegerDigits[#]]] == Length[x] && PrimeQ[FromDigits[Reverse[x]]] &] (* Jayanta Basu, Jun 28 2013 *)
  • Python
    from sympy import prime, isprime
    A046732 = [p for p in (prime(n) for n in range(1,10**3)) if len(str(p)) == len(set(str(p))) and isprime(int(str(p)[::-1]))] # Chai Wah Wu, Aug 14 2014

Extensions

More terms from Jud McCranie.

A007628 Reflectable emirps.

Original entry on oeis.org

13, 31, 113, 311, 1031, 1033, 1103, 1181, 1301, 1381, 1811, 1831, 3011, 3083, 3301, 3803, 10333, 11003, 11083, 11833, 18013, 18133, 18803, 30011, 30881, 31033, 31081, 31183, 33013, 33181, 33301, 33811, 38011, 38113
Offset: 1

Views

Author

Keywords

Comments

Subsequence of A125308, the reflectable primes. - Reinhard Zumkeller, Jul 16 2014

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • C. W. Trigg, "Reflective Primes", J. Rec. Math., 15 (1983), 251-256.

Crossrefs

Programs

  • Haskell
    a007628 n = a007628_list !! (n-1)
    a007628_list = filter f a125308_list where
       f p = a010051' q == 1 && q /= p  where q = a004086 p
    -- Reinhard Zumkeller, Jul 16 2014

Extensions

Missing 1811 inserted by Reinhard Zumkeller, Jul 16 2014

A048051 First occurrence of 11 consecutive and reversible primes (emirps).

Original entry on oeis.org

1477271183, 1477271249, 1477271251, 1477271269, 1477271291, 1477271311, 1477271317, 1477271351, 1477271357, 1477271381, 1477271387
Offset: 1

Views

Author

Keywords

Examples

			The reverse of prime 1477271183 is 3811727741 is also prime, as are all of these numbers.
		

Crossrefs

A048053 Smallest sequence of 12 consecutive reversible primes (emirps).

Original entry on oeis.org

9387802769, 9387802807, 9387802817, 9387802861, 9387802867, 9387802873, 9387802909, 9387802937, 9387802939, 9387802973, 9387802987, 9387803003
Offset: 1

Views

Author

Keywords

Examples

			The reverse of prime 9387802769 is 9672087839 is also prime, as are all of these numbers.
		

Crossrefs

A346022 Primes that are the first in a run of exactly 2 emirps.

Original entry on oeis.org

13, 31, 337, 701, 761, 937, 983, 1151, 1279, 1831, 1933, 3191, 3803, 3851, 3911, 7043, 7219, 7457, 7523, 7643, 9127, 9161, 9241, 9437, 9521, 9547, 9601, 9871, 9931, 10007, 10151, 10247, 10487, 10639, 10853, 10889, 11071, 11657, 11833, 12071, 12547, 12689
Offset: 1

Views

Author

Lars Blomberg, Jul 01 2021

Keywords

Comments

There are large gaps in this sequence because all terms need to begin with 1, 3, 7, or 9 otherwise the reversal is composite.

Examples

			a(2) = 31 because of the four consecutive primes 29, 31, 37, 41 only 31, 37 are emirps.
		

Crossrefs

Subsequence of A006567 (emirps).

Programs

  • Python
    from sympy import isprime, nextprime
    def isemirp(p): s = str(p); return s != s[::-1] and isprime(int(s[::-1]))
    def aupto(limit):
      alst, pvec, evec, p = [], [2, 3, 5, 7], [0, 0, 0, 0], 11
      while pvec[1] <= limit:
        if evec == [0, 1, 1, 0]: alst.append(pvec[1])
        pvec = pvec[1:] + [p]; evec = evec[1:] + [isemirp(p)]; p = nextprime(p)
      return alst
    print(aupto(12689)) # Michael S. Branicky, Jul 04 2021

A346023 Primes that are the first in a run of exactly 3 emirps.

Original entry on oeis.org

71, 953, 1021, 1097, 1381, 1499, 1583, 1723, 3011, 3083, 3271, 3343, 3463, 7673, 7949, 9209, 9479, 10453, 10987, 11149, 12289, 12743, 13499, 13751, 14057, 14087, 14549, 15289, 15649, 15731, 16103, 16193, 16567, 17033, 17203, 17669, 17737, 17903, 18899, 19793
Offset: 1

Views

Author

Lars Blomberg, Jul 02 2021

Keywords

Comments

There are large gaps in this sequence because all terms need to begin with 1, 3, 7, or 9 otherwise the reversal is composite.

Examples

			a(1) = 71 because of the five consecutive primes 67, 71, 73, 79, 83 all except 67 and 83 are emirps and this is the first such occurrence.
		

Crossrefs

Subsequence of A006567 (emirps)

Programs

  • Mathematica
    Select[Prime@Range@10000,Boole[PrimeQ@#&&!PalindromeQ@#&/@(IntegerReverse/@NextPrime[#,Range[-1,3]])]=={0,1,1,1,0}&] (* Giorgos Kalogeropoulos, Jul 04 2021 *)
  • Python
    from sympy import isprime, primerange
    def isemirp(p): s = str(p); return s != s[::-1] and isprime(int(s[::-1]))
    def aupto(limit):
        alst, pvec, evec = [], [2, 3, 5, 7, 11], [0, 0, 0, 0, 0]
        for p in primerange(13, limit+1):
            if evec == [0, 1, 1, 1, 0]: alst.append(pvec[1])
            pvec = pvec[1:] + [p]; evec = evec[1:] + [isemirp(p)]
        return alst
    print(aupto(20000)) # Michael S. Branicky, Jul 04 2021
Showing 1-10 of 19 results. Next