login
Number of primes between n^3 - n and n^3.
3

%I #20 Mar 17 2013 17:26:31

%S 0,1,0,1,0,1,1,1,1,2,2,2,0,2,3,2,2,2,2,1,2,3,4,1,3,3,2,3,3,3,2,1,3,2,

%T 4,4,3,2,1,2,7,4,2,2,4,3,4,7,3,5,7,4,6,5,4,2,8,4,3,4,2,5,7,7,4,3,8,4,

%U 1,3,2,10,4,5,4,6,7,8,6,6,1,6,8,8,7,7,6,7,4,10

%N Number of primes between n^3 - n and n^3.

%C Conjecture: a(n) > 0 for n > 13.

%H Alois P. Heinz, <a href="/A216265/b216265.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000720(n^3) - A000720(n^3-n).

%e a(9) = 1 because between 9^3 - 9 and 9^3 there is just one prime (727).

%e a(10) = 2 because between 10^3 - 10 and 10^3 there are two primes (991 and 997).

%e a(11) = 2 because between 11^3 - 11 and 11^3 there are two primes (1321 and 1327).

%p a:= n-> add(`if`(isprime(t), 1, 0), t=n^3-n..n^3):

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 17 2013

%t Table[PrimePi[n^3] - PrimePi[n^3 - n], {n, 100}] (* _Alonso del Arte_, Mar 17 2013 *)

%o (Java)

%o import java.math.BigInteger;

%o public class A216265 {

%o public static void main (String[] args) {

%o for (long n = 1; n < (1 << 21); n++) {

%o long cube = n*n*n, c = 0;

%o for (long k = cube - n; k < cube; ++k) {

%o BigInteger b1 = BigInteger.valueOf(k);

%o if (b1.isProbablePrime(2)) {

%o if (b1.isProbablePrime(80))

%o ++c;

%o }

%o }

%o System.out.printf("%d, ", c);

%o }

%o }

%o } // Ratushnyak

%o (PARI)

%o default(primelimit,10^7);

%o a(n) = primepi(n^3) - primepi(n^3-n);

%o /* _Joerg Arndt_, Mar 16 2013 */

%Y Cf. A094189, A216266.

%K nonn

%O 1,10

%A _Alex Ratushnyak_, Mar 15 2013