OFFSET
1,1
COMMENTS
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.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
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.
MATHEMATICA
a[n_] := PrimePi[Prime[n]^2] - PrimePi[(Prime[n] - 1)^2]; Table[a[n], {n, 74}] (* Ray Chandler, Sep 06 2005 *)
PROG
(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
(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
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Enoch Haga, Sep 05 2005
EXTENSIONS
Edited by Ray Chandler, Sep 06 2005
STATUS
approved