login
Number of odd numbers between prime(n) and prime(n+1).
2

%I #49 Jan 04 2023 03:25:01

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

%T 0,2,2,1,2,2,0,4,0,1,0,5,5,1,0,1,2,0,4,2,2,2,0,2,1,0,4,6,1,0,1,6,2,4,

%U 0,1,2,3,2,2,1,2,3,1,3,4,0,4,0,2,1,2,3,1,0,1,5,3,1,3,1,2,5,0,8,2,4,2,2,0,2

%N Number of odd numbers between prime(n) and prime(n+1).

%H Muniru A Asiru, <a href="/A100820/b100820.txt">Table of n, a(n) for n = 1..2000</a>

%F a(n) = (prime(n+1)-prime(n))/2-1 = A001223(n)/2-1 for n>=2. - _Robert Israel_, Jun 01 2016

%F a(n) = A028334(n) - 1 for n>=2. - _Michel Marcus_, Jan 04 2023

%e a(2)=0 because between 3 and 5 there are no odd numbers.

%e a(3)=0 because between 5 and 7 there are no odd numbers.

%p P:= select(isprime,[seq(i,i=3..1000,2)]):

%p 0,op(map(`-`,1/2*(P[2..-1]-P[1..-2]),1)); # _Robert Israel_, Jun 01 2016

%t Table[Floor[Max[(Prime[n + 1] - Prime[n])/2 - 1, 0] ], {n, 120}] (* _Ray Chandler_, Jan 09 2005 *)

%o (Magma) [0] cat [(NthPrime(n+1)-NthPrime(n))/2-1 : n in [2..100]]; // _Wesley Ivan Hurt_, Jun 01 2016

%Y Cf. A000040, A001223, A028334, A036263.

%K easy,nonn

%O 1,9

%A _Giovanni Teofilatto_, Jan 06 2005

%E Corrected and extended by _Ray Chandler_, Jan 09 2005