login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A006567 Emirps (primes whose reversal is a different prime).
(Formerly M4887)
195

%I M4887 #81 Oct 02 2023 02:39:02

%S 13,17,31,37,71,73,79,97,107,113,149,157,167,179,199,311,337,347,359,

%T 389,701,709,733,739,743,751,761,769,907,937,941,953,967,971,983,991,

%U 1009,1021,1031,1033,1061,1069,1091,1097,1103,1109,1151,1153,1181,1193,1201

%N Emirps (primes whose reversal is a different prime).

%C 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.

%C The term "emirp" was coined by the American mathematician Jeremiah Farrell (1937-2022). - _Amiram Eldar_, Jun 11 2021

%D Martin Gardner, The Magic Numbers of Dr Matrix. Prometheus, Buffalo, NY, 1985, p. 230.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A006567/b006567.txt">Table of n, a(n) for n = 1..10000</a>

%H Chris K. Caldwell, The Prime Glossary, <a href="https://t5k.org/glossary/page.php?sort=emirp">emirp</a>.

%H Brady Haran and N. J. A. Sloane, <a href="https://www.youtube.com/watch?v=OeGSQggDkxI">What Number Comes Next?</a>, Numberphile video, 2018.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Emirp.html">Emirp</a>.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Emirp">Emirp</a>.

%p 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:

%p 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:

%p seq(A006567(n),n=1..120) ; # _R. J. Mathar_, May 24 2010

%t 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 *)

%t Select[Prime[Range[5,200]],PrimeQ[IntegerReverse[#]]&&!PalindromeQ[#]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 11 2021 *)

%o (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

%o (PARI) is(n)=my(r=eval(concat(Vecrev(Str(n)))));isprime(r)&&r!=n&&isprime(n) \\ _Charles R Greathouse IV_, Nov 20 2012

%o (PARI) select( {is_A006567(n,r=fromdigits(Vecrev(digits(n))))=isprime(r)&&r!=n&&isprime(n)}, primes(200)) \\ _M. F. Hasler_, Jan 31 2020

%o (Haskell)

%o a006567 n = a006567_list !! (n-1)

%o a006567_list = filter f a000040_list where

%o f p = a010051' q == 1 && q /= p where q = a004086 p

%o -- _Reinhard Zumkeller_, Jul 16 2014

%o (Python)

%o from sympy import prime, isprime

%o 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

%o (Python)

%o from sympy import isprime, nextprime

%o def emirps(start=1, end=float('inf')): # generator for emirps in start..end

%o p = nextprime(start-1)

%o while p <= end:

%o s = str(p)

%o if s[0] in "24568":

%o p = nextprime((int(s[0])+1)*10**(len(s)-1)); continue

%o revp = int(s[::-1])

%o if p != revp and isprime(revp): yield p

%o p = nextprime(p)

%o print(list(emirps(end=1201))) # _Michael S. Branicky_, Jan 24 2021, updated Jul 28 2022

%Y Cf. A003684, A007628 (subsequence), A046732, A048051, A048052, A048053, A048054, A048895, A004086 (read n backwards).

%Y A007500 is the union of A002385 and this sequence.

%K nonn,nice,easy,base

%O 1,1

%A _N. J. A. Sloane_

%E More terms from _James A. Sellers_, Jan 22 2000

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 03:29 EDT 2024. Contains 371782 sequences. (Running on oeis4.)