login
Least k >= 0 such that (2*n-1)*2^k - 1 or (2*n-1)*2^k + 1 is prime, or -1 if no such value exists.
13

%I #20 Oct 17 2014 11:48:23

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

%T 1,2,2,1,2,1,1,1,4,1,1,1,2,1,1,1,3,3,1,3,6,1,1,1,1,1,1,2,1,2,1,1,3,1,

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

%N Least k >= 0 such that (2*n-1)*2^k - 1 or (2*n-1)*2^k + 1 is prime, or -1 if no such value exists.

%C Bisection of A194591: a(n) = A194591(2*n-1).

%C A194637 gives the record values.

%H Arkadiusz Wesolowski, <a href="/A194636/b194636.txt">Table of n, a(n) for n = 1..1000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/BrierNumber.html">Brier Number</a>

%e For n=4, 7*2^0-1 and 7*2^0+1 are composite, but 7*2^1-1=13 is prime, so a(4)=1.

%t Table[n = 2*n - 1; k = 0; While[! PrimeQ[n*2^k - 1] && ! PrimeQ[n*2^k + 1], k++]; k, {n, 100}] (* _Arkadiusz Wesolowski_, Sep 04 2011 *)

%t p[n_]:=Module[{c=2n-1,k=0},While[!Or@@PrimeQ[c*2^k+{1,-1}],k++];k]; Array[ p,90] (* _Harvey P. Dale_, Mar 08 2013 *)

%Y Cf. A194591, A194600, A194603, A194606, A194607, A194608, A194635, A194637, A194638, A194639.

%Y Cf. A040081, A040076, A076335, A180247.

%K sign

%O 1,7

%A _Arkadiusz Wesolowski_, Aug 31 2011