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!)
A003684 Number of n-digit reversible primes (or emirps) with distinct digits. 21

%I #19 Aug 25 2024 13:13:17

%S 4,8,22,84,402,1218,3572,8218,11804

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

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

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

%o (Python)

%o from sympy import primerange, isprime

%o def A003684(n):

%o return len([p for p in primerange(10**(n-1),10**n)

%o if len(set(str(p))) == len(str(p)) and isprime(int(str(p)[::-1]))])

%o # _Chai Wah Wu_, Aug 14 2014

%Y Cf. A006567, A007628, A046732, A048051, A048052, A048053, A048054, A048895.

%K nonn,fini,full,base,easy,nice

%O 1,1

%A _Harvey P. Dale_ and _Jud McCranie_

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

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 September 13 20:16 EDT 2024. Contains 375910 sequences. (Running on oeis4.)