login

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

a(n) = next-to-most-significant binary digit of n-th composite positive integer.
2

%I #15 Mar 20 2015 23:18:04

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

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

%U 0,0,1,1,1,1,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,0,0

%N a(n) = next-to-most-significant binary digit of n-th composite positive integer.

%C The length of each run of zeros and ones: 1,3,6,13,25,53,107,219,445,899,1821,... and 1,3,5,12,26,52,106,218,442,894,1811,2838,..., . - _Robert G. Wilson v_

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

%e a(2) = 1 because 6 is the second composite and because the next-to-most-significant binary digit (which happens to be the middle binary digit) of 6 = 110 (in binary) is 1.

%t f[n_] := IntegerDigits[ FixedPoint[n + PrimePi[ # ] + 1 &, n], 2][[2]]; Array[f, 105] (* _Robert G. Wilson v_ *)

%Y Cf. A115454, A112416.

%K base,nonn

%O 1,1

%A _Leroy Quet_, Jan 22 2006

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