[go: up one dir, main page]

login

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”).

Number of primes between (prime(n)-1)^2 and prime(n)^2.
2

%I #14 Apr 29 2024 09:08:54

%S 2,2,3,4,5,5,7,6,7,9,8,9,12,9,10,16,13,16,15,21,15,18,19,18,21,23,20,

%T 24,23,25,29,28,23,27,33,32,27,32,33,30,29,36,34,37,37,37,38,41,45,38,

%U 39,49,47,45,53,46,53,46,45,49,53,51,48,49,55,51,62,66,61,61,60,66,63,61

%N Number of primes between (prime(n)-1)^2 and prime(n)^2.

%C Begin with the first prime, compute square root, take floor and add 1. If result is a prime number then begin the count for that prime value. Increment the count until prime value changes.

%H Amiram Eldar, <a href="/A112341/b112341.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000720(A000040(n)^2) - A000720((A000040(n)-1)^2). - _Ray Chandler_, Sep 06 2005

%e a(5) = 5 because for primes 101-103-107-109-113 the floor of the square root of each is 10. For each 10, 1 is added, so for prime 11 the count is 5.

%t a[n_] := PrimePi[Prime[n]^2] - PrimePi[(Prime[n] - 1)^2]; Table[a[n], {n, 74}] (* _Ray Chandler_, Sep 06 2005 *)

%o (UBASIC) 10 A=1 20 B=nxtprm(B) 30 C=int(sqrt(B)) 40 D=C+1 50 if E=D then N=N+1:else print N:N=1:stop 60 if D=prmdiv(D) then print B;C;D;"-" 70 E=D 80 goto 20

%o (PARI) lista(pmax) = {my(c = 0); forprime(p = 2, pmax, c = 0; forprime(q = (p-1)^2, p^2, c++); print1(c, ", "));} \\ _Amiram Eldar_, Apr 29 2024

%Y Cf. A000040, A000720, A112342.

%K easy,nonn

%O 1,1

%A _Enoch Haga_, Sep 05 2005

%E Edited by _Ray Chandler_, Sep 06 2005