login
Number of primes between n and 2^n exclusive.
2

%I #29 Jun 11 2024 04:32:31

%S 0,1,2,4,8,15,27,50,93,168,304,559,1022,1894,3506,6536,12244,22993,

%T 43382,82017,155603,295939,564154,1077862,2063680,3957800,7603544,

%U 14630834,28192740,54400018,105097554,203280210,393615795,762939100,1480206268,2874398504

%N Number of primes between n and 2^n exclusive.

%H Amiram Eldar, <a href="/A284275/b284275.txt">Table of n, a(n) for n = 1..92</a> (calculated from the b-file at A007053; terms 1..47 from Vincenzo Librandi)

%F a(n) = A007053(n) - A000720(n), for n > 1. - _Michel Marcus_, Mar 26 2017

%e a(3) = 2 because there are 2 primes between 3 and 2^3: 5, 7 (we don't count the boundary of the interval in this case).

%e a(4) = 4 because there are 4 primes between 4 and 2^4: 5, 7, 11, 13.

%t Join[{0}, Table[PrimePi[2^n] - PrimePi[n],{n, 2, 36}]] (* Improved by _Alonso del Arte_, Mar 26 2017 *)

%o (Magma) [0] cat [#PrimesInInterval(n+1, 2^n): n in [2..28]];

%o (PARI) a(n) = if (n==1, 0, primepi(2^n) - primepi(n)); \\ _Michel Marcus_, Mar 26 2017

%o (Python)

%o from sympy import primepi

%o def a(n): return primepi(2**n - 1) - primepi(n) # _Indranil Ghosh_, Mar 26 2017

%Y Cf. A000720, A007053, A060715.

%K nonn

%O 1,3

%A _Vincenzo Librandi_, Mar 26 2017