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

A112342
Number of primes between (n-th composite - 1)^2 and (n-th composite)^2.
2
2, 2, 3, 4, 3, 4, 5, 4, 6, 5, 6, 7, 7, 6, 9, 8, 7, 8, 8, 10, 9, 10, 9, 10, 9, 12, 11, 11, 12, 11, 13, 13, 15, 10, 11, 15, 12, 13, 11, 12, 17, 16, 13, 17, 15, 14, 16, 15, 17, 13, 15, 17, 17, 18, 22, 14, 23, 13, 20, 20, 17, 16, 21, 22, 18, 20, 20, 19, 23, 21, 21, 22, 23, 21, 22, 21, 21
OFFSET
1,1
COMMENTS
Declare a current total to 0 and a current composite to 4 and a current index n to 1. For each prime p, compute c:=floor(sqrt(p)) + 1. If c is composite then see if c is equal to the current composite. If it is, add 1 to the current total. Else a(n) = current total and set the current total to 1. If enough terms of the sequence have been found, store the found terms and end the algorithm. - David A. Corneth, Jun 03 2024
LINKS
David A. Corneth, PARI program
FORMULA
a(n) = A000720(A002808(n)^2) - A000720((A002808(n)-1)^2). - Ray Chandler, Sep 06 2005
EXAMPLE
a(1)=2 because for primes 11 and 13, the floor of the square root of both primes is 3. Since 1 is added to each, 3+1=4, for the composite 4 the count is 2.
MATHEMATICA
Table[PrimePi[ResourceFunction["Composite"][n]^2]-PrimePi[(ResourceFunction["Composite"][n]-1)^2], {n, 77}] (* James C. McMahon, Jun 02 2024 *)
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) \\ See Corneth link
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enoch Haga, Sep 05 2005
EXTENSIONS
Edited by Ray Chandler, Sep 06 2005
STATUS
approved