Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #23 Dec 27 2023 11:58:02
%S 11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,
%T 103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,
%U 193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283
%N Primes having a prime number of digits.
%C Before the 20th century, this sequence would have contained the numbers 1,2,3,5,7; see A008578.
%C There are a total of 8527 terms for primes with 2, 3, or 5 digits, and a total of 594608 terms if primes with 7 digits are also included. - _Harvey P. Dale_, Nov 02 2020
%H Jeppe Stig Nielsen, <a href="/A120533/b120533.txt">Table of n, a(n) for n = 1..10000</a>
%e 10007 is a 5-digit prime and so belongs to the sequence.
%t Table[Prime[Range[PrimePi[10^(p-1)]+1,PrimePi[10^p]]],{p,Prime[Range[ 3]]}]//Flatten (* _Harvey P. Dale_, Nov 02 2020 *)
%o (PARI) g(n) = forprime(x=11,n,if(isprime(length(Str(x))),print1(x",")))
%o (PARI) forprime(p=2,5,forprime(q=10^(p-1),10^p,print1(q", "))) \\ _Charles R Greathouse IV_, Oct 04 2011
%o (Python)
%o from itertools import islice
%o from sympy import isprime, nextprime
%o def agen(): # generator of terms
%o d = 2
%o while True:
%o yield from (i for i in range(10**(d-1)+1, 10**d, 2) if isprime(i))
%o d = nextprime(d)
%o print(list(islice(agen(), 57))) # _Michael S. Branicky_, Dec 27 2023
%Y Cf. A000040, A124888.
%K base,nonn
%O 1,1
%A _Cino Hilliard_, Aug 06 2006
%E Edited by _N. J. A. Sloane_ at the suggestion of _Andrew S. Plewe_, May 21 2007