login
Next-to-most-significant binary digit of the n-th prime.
2

%I #13 Jul 12 2015 20:13:40

%S 0,1,0,1,0,1,0,0,0,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,

%T 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0

%N Next-to-most-significant binary digit of the n-th prime.

%C The length of the run of zeros pi(2^n+2^(n-1))-pi(2^n) (A095765): 1, 1, 1, 3, 4, 6, 12, 22, 38, 70, 130, 237, 441, ... and the length of the run of ones pi(2^n-1)-pi(2^n-2^(n-2)-1) (A095766): 1, 1, 1, 2, 3, 7, 11, 21, 37, 67, 125, 227, 431, ..., . - _Robert G. Wilson v_

%F a(n) = floor((p(n) - 2^m)/2^(m-1)), where p(n) is the n-th prime and m = floor(log(p(n))/log(2)).

%e The 9th prime is 23 (in decimal), which is 10111 in binary. So a(9) = 0, the next-to-most significant binary digit of 23.

%t f[n_] := IntegerDigits[Prime@n, 2][[2]]; Array[f, 105] (* _Robert G. Wilson v_ *)

%Y Cf. A004676, A106701.

%K base,nonn

%O 1,1

%A _Leroy Quet_, Dec 09 2005

%E More terms from _Robert G. Wilson v_, Jan 24 2006