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 11 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

A007500 Primes whose reversal in base 10 is also prime (called "palindromic primes" by David Wells, although that name usually refers to A002385). Also called reversible primes.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 107, 113, 131, 149, 151, 157, 167, 179, 181, 191, 199, 311, 313, 337, 347, 353, 359, 373, 383, 389, 701, 709, 727, 733, 739, 743, 751, 757, 761, 769, 787, 797, 907, 919, 929, 937, 941, 953, 967, 971, 983, 991, 1009, 1021
Offset: 1

Views

Author

Keywords

Comments

The numbers themselves need not be palindromes.
The range is a subset of the range of A071786. - Reinhard Zumkeller, Jul 06 2009
Number of terms less than 10^n: 4, 13, 56, 260, 1759, 11297, 82439, 618017, 4815213, 38434593, ..., . - Robert G. Wilson v, Jan 08 2015

References

  • Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer 2010, pp. 39, 131-132
  • 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 113.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 134.

Crossrefs

Cf. A002385 (primes that are palindromes in base 10).
Equals A002385 union A006567.
Complement of A076056 with respect to A000040. [From Reinhard Zumkeller, Jul 06 2009]

Programs

  • Haskell
    a007500 n = a007500_list !! (n-1)
    a007500_list = filter ((== 1) . a010051 . a004086) a000040_list
    -- Reinhard Zumkeller, Oct 14 2011
    
  • Magma
    [ p: p in PrimesUpTo(1030) | IsPrime(Seqint(Reverse(Intseq(p)))) ];  // Bruno Berselli, Jul 08 2011
    
  • Maple
    revdigs:= proc(n)
    local L,nL,i;
    L:= convert(n,base,10);
    nL:= nops(L);
    add(L[i]*10^(nL-i),i=1..nL);
    end:
    Primes:= select(isprime,{2,seq(2*i+1,i=1..5*10^5)}):
    Primes intersect map(revdigs,Primes); # Robert Israel, Aug 14 2014
  • Mathematica
    Select[ Prime[ Range[ 168 ] ], PrimeQ[ FromDigits[ Reverse[ IntegerDigits[ # ] ] ] ]& ] (* Zak Seidov, corrected by T. D. Noe *)
    Select[Prime[Range[1000]],PrimeQ[IntegerReverse[#]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 15 2016 *)
  • PARI
    is_A007500(n)={ isprime(n) & is_A095179(n)} \\ M. F. Hasler, Jan 13 2012
    
  • Python
    from sympy import prime, isprime
    A007500 = [prime(n) for n in range(1,10**6) if isprime(int(str(prime(n))[::-1]))] # Chai Wah Wu, Aug 14 2014
    
  • Python
    from gmpy2 import is_prime, mpz
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield from [2, 3, 5, 7]
        p = 11
        for digits in count(2):
            for first in "1379":
                for mid in product("0123456789", repeat=digits-2):
                    for last in "1379":
                        s = first + "".join(mid) + last
                        if is_prime(t:=mpz(s)) and is_prime(mpz(s[::-1])):
                            yield int(t)
    print(list(islice(agen(), 60))) # Michael S. Branicky, Jan 02 2025

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Oct 31 2000
Added further terms to the sequence Avik Roy (avik_3.1416(AT)yahoo.co.in), Jan 16 2009. Checked by N. J. A. Sloane, Jan 20 2009.
Third reference added by Harvey P. Dale, Oct 17 2011

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

A003684 Number of n-digit reversible primes (or emirps) with distinct digits.

Original entry on oeis.org

4, 8, 22, 84, 402, 1218, 3572, 8218, 11804
Offset: 1

Views

Author

Keywords

Examples

			13, 17, 31, 37, 71, 73, 79 and 97 are reversible primes (emirps), so a(2)=8.
		

Crossrefs

Programs

  • Mathematica
    emrpQ[n_]:=Module[{idn=IntegerDigits[n],rev},rev=Reverse[idn];rev!=idn && Max[DigitCount[n]] ==1&&PrimeQ[FromDigits[rev]]]; With[{ems=Select[ Prime[ Range[ 51*10^6]],emrpQ]},Join[ {4},Table[Count[ems,?(IntegerLength[ #] == n&)],{n,2,9}]]] (* _Harvey P. Dale, Nov 29 2014 *)
  • Python
    from sympy import primerange, isprime
    def A003684(n):
        return len([p for p in primerange(10**(n-1),10**n)
        if len(set(str(p))) == len(str(p)) and isprime(int(str(p)[::-1]))])
    # Chai Wah Wu, Aug 14 2014

Extensions

Typo in example corrected by David Ritterskamp (dritters(AT)usi.edu), Mar 24 2008

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.

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

A125308 Primes having only {0, 1, 3, 8} as digits.

Original entry on oeis.org

3, 11, 13, 31, 83, 101, 103, 113, 131, 181, 311, 313, 331, 383, 811, 881, 883, 1013, 1031, 1033, 1103, 1181, 1301, 1303, 1381, 1801, 1811, 1831, 3001, 3011, 3083, 3181, 3301, 3313, 3331, 3803, 3833, 3881, 8011, 8081, 8101, 8111, 8311, 8803, 8831, 10103
Offset: 1

Views

Author

G. L. Honaker, Jr., Dec 10 2006

Keywords

Comments

Original name: Reflectable primes: those which are invariant upon mirror reflection along the line they are written on. Must contain only the digits 0, 1, 3, or 8.
A rough heuristic argument suggests that there are infinite pairs (n, prime(n)) in which both n and prime(n) are reflectable, like in prime(1101088113338) = 33138318000311. See Links for a table of the first 250 such pairs. - Giovanni Resta, Mar 10 2013

Crossrefs

Cf. A010051, A007628 (reflectable emirps).

Programs

  • Haskell
    import Data.List (intersect)
    a125308 n = a125308_list !! (n-1)
    a125308_list = 3 : h [1,3] where
       h (u:us) | null (show v `intersect` "245679") &&
                  a010051' v == 1 = v : h (us ++ [v])
                | otherwise       = h (us ++ [v])
                where v = u + 10
    -- Reinhard Zumkeller, Jul 16 2014
  • Mathematica
    Select[FromDigits /@ Tuples[{0, 1, 3, 8}, 5], PrimeQ[#] &] (* Arkadiusz Wesolowski, Mar 06 2013 *)

Extensions

More terms from Arkadiusz Wesolowski, Mar 06 2013
Showing 1-10 of 11 results. Next