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.

A120533 Primes having a prime number of digits.

This page as a plain text file.
%I A120533 #27 Feb 03 2025 16:58:19
%S A120533 11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,
%T A120533 103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,
%U A120533 193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283
%N A120533 Primes having a prime number of digits.
%C A120533 Before the 20th century, this sequence would have contained the numbers 1,2,3,5,7; see A008578.
%C A120533 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 A120533 Jeppe Stig Nielsen, <a href="/A120533/b120533.txt">Table of n, a(n) for n = 1..10000</a>
%e A120533 10007 is a 5-digit prime and so belongs to the sequence.
%t A120533 Table[Prime[Range[PrimePi[10^(p-1)]+1,PrimePi[10^p]]],{p,Prime[Range[ 3]]}]//Flatten (* _Harvey P. Dale_, Nov 02 2020 *)
%o A120533 (PARI) g(n) = forprime(x=11,n,if(isprime(length(Str(x))),print1(x",")))
%o A120533 (PARI) forprime(p=2,5,forprime(q=10^(p-1),10^p,print1(q", "))) \\ _Charles R Greathouse IV_, Oct 04 2011
%o A120533 (Python)
%o A120533 from itertools import islice
%o A120533 from sympy import isprime, nextprime
%o A120533 def agen(): # generator of terms
%o A120533     d = 2
%o A120533     while True:
%o A120533         yield from (i for i in range(10**(d-1)+1, 10**d, 2) if isprime(i))
%o A120533         d = nextprime(d)
%o A120533 print(list(islice(agen(), 57))) # _Michael S. Branicky_, Dec 27 2023
%o A120533 (Python)
%o A120533 from sympy import primepi, primerange
%o A120533 def A272441(n):
%o A120533     def bisection(f,kmin=0,kmax=1):
%o A120533         while f(kmax) > kmax: kmax <<= 1
%o A120533         kmin = kmax >> 1
%o A120533         while kmax-kmin > 1:
%o A120533             kmid = kmax+kmin>>1
%o A120533             if f(kmid) <= kmid:
%o A120533                 kmax = kmid
%o A120533             else:
%o A120533                 kmin = kmid
%o A120533         return kmax
%o A120533     def f(x): return n+x-sum(primepi(min(x,(1<<i)-1))-primepi((1<<i-1)-1) for i in primerange(2,x.bit_length()+1))
%o A120533     return bisection(f,n,n) # _Chai Wah Wu_, Feb 03 2025
%Y A120533 Cf. A000040, A124888.
%K A120533 base,nonn
%O A120533 1,1
%A A120533 _Cino Hilliard_, Aug 06 2006
%E A120533 Edited by _N. J. A. Sloane_ at the suggestion of _Andrew S. Plewe_, May 21 2007