%I #13 Mar 21 2024 20:37:58
%S 0,0,0,2,3,3,5,4,7,5,7,6,11,7,13,8,11,9,17,10,19,11,15,12,23,13,21,14,
%T 19,15,29,16,31,17,23,18,29,19,37,20,27,21,41,22,43,23,31,24,47,25,43,
%U 26,35,27,53,28,45,29,39,30,59,31,61,32,43,33,53,34,67,35,47,36,71,37,73,38,51,39,67,40,79,41,55,42,83,43,69,44,59,45,89,46,79
%N Least k>n/2, k<n, such that 2^(n-k)-1 divides 2^k-2, or 0 if no such k exists.
%C Related to the search of primitive weird numbers A006037 of the form 2^(k-1)*Q*R with Q=2^n-1 and R=(2^k*Q-Q-1)/(Q+1-2^k). (Of course only primes n can lead to a (Mersenne) prime Q (cf. A000043), and R must also be prime to get a weird number.)
%C For n>2, there always exists such a k=a(n)>0, since k=n-1 trivially satisfies the condition (2^(n-k)-1 = 1).
%C For odd indices n>2, k=a(n)=(n+1)/2 since this is the least k>n/2 and 2^(k-1)-1 divides 2^k-2.
%F For n = 2m-1 > 2, a(n) = m.
%F For all n, a(n) <= n-1, and equality holds when n-1 is a prime.
%F Conjecture: a(n) = n - A032742(n-1), for n > 2. - _Ridouane Oudra_, Mar 17 2024
%Y Cf. A032742.
%K nonn
%O 0,4
%A _M. F. Hasler_, Aug 17 2014