login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Number of primes between prime(n)*prime(n+1) and prime(n+1)^2.
5

%I #14 Jul 31 2021 17:50:19

%S 1,3,4,9,5,14,6,15,25,8,30,23,9,23,42,42,16,47,35,15,54,39,62,88,44,

%T 20,45,23,52,194,52,84,27,158,32,92,97,63,96,99,36,176,37,71,37,236,

%U 252,83,38,81,141,47,222,142,134,155,46,145,94,53,252,381,105,55,107,398,176,296,61

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

%H Antti Karttunen, <a href="/A256469/b256469.txt">Table of n, a(n) for n = 1..6541</a>

%F a(n) = A256448(n)+2.

%F a(n) = A050216(n) - A256468(n).

%F a(n) = A256468(n) + A256470(n).

%e For n=1, there is only one prime in range prime(1)*prime(2) .. prime(2)^2, [6 .. 9], namely 7, thus a(1) = 1.

%e For n=2, the primes in range prime(2)*prime(3) .. prime(3)^2, [15 .. 25] are {17, 19, 23}, thus a(2) = 3.

%t Table[Count[Range[Prime[n] Prime[n + 1], Prime[n + 1]^2], _?PrimeQ], {n, 69}] (* _Michael De Vlieger_, Mar 30 2015 *)

%t Table[PrimePi[Prime[n+1]^2]-PrimePi[Prime[n]Prime[n+1]],{n,70}] (* _Harvey P. Dale_, Jul 31 2021 *)

%o (PARI)

%o allocatemem(234567890);

%o default(primelimit,4294965247);

%o A256469(n) = (primepi(prime(n+1)^2) - primepi(prime(n)*prime(n+1)));

%o for(n=1, 6541, write("b256469.txt", n, " ", A256469(n)));

%o (Scheme) (define (A256469 n) (let* ((p (A000040 n)) (q (A000040 (+ 1 n))) (q2 (* q q))) (let loop ((s 0) (k (* p q))) (cond ((= k q2) s) (else (loop (+ s (if (prime? k) 1 0)) (+ k 1)))))))

%Y Cf. A050216, A256448, A256468, A256470.

%K nonn

%O 1,2

%A _Antti Karttunen_, Mar 30 2015