%I #32 Sep 05 2019 19:23:37
%S 0,1,1,2,1,1,2,2,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,
%T 0,0,0
%N Number of integers k such that R = (2^k*Q - Q - 1)/(Q + 1 - 2^k) is a prime number, when Q = A000668(n) is the n-th Mersenne prime.
%C Related to the search of large primitive weird numbers: Kravitz has shown that 2^(k-1)*Q*R is a primitive weird number (cf. A002975) when Q > 2^k and R = (2^k*Q - Q - 1)/(Q + 1 - 2^k) both are prime. Here we count such primes for the special case where Q = 2^p - 1 is a Mersenne prime, p=A000043(n). For such Q one has R = 2^k - 1 + (2^k - 2)/(2^(p-k) - 1).
%C See A242025 for the resulting primes R, which however are there not listed in order of the p's.
%C This sequence gives the row lengths for the table A243003 whose rows hold the k-values leading to prime R, for a given Mersenne prime.
%H S. Kravitz, A search for large weird numbers. J. Recreational Math. 9(1976), 82-85 (1977). <a href="http://zbmath.org/?format=complete&q=an:0365.10003">Zbl 0365.10003</a>
%H E. Weisstein, <a href="http://mathworld.wolfram.com/WeirdNumber.html">Weird numbers</a>, on MathWorld - a Wolfram web ressource.
%e For given p=A000043(n), the following k's yield a prime R:
%e p : k's (and resulting primes R, Q=2^p-1 and/or weird W=2^(k-1)*Q*R)
%e 2 : -
%e 3 : 2 (R=5, Q=7, W=70)
%e 5 : 4 (R=29, Q=31, W=7192)
%e 7 : 4 (R=17, Q=127, W=17272), 5 (R=41, Q=127, W=83312)
%e 13 : 11 (R=2729, Q=8191, W=22889716736)
%e 17 : 13 (R=8737, Q=131071, W=4690605371392)
%e 19 : 16 (R=74897, W=1286718208049152), 17 (R=174761, W=6004730783793152)
%e 31 : 16 (R=65537, W=2^15*(2^31-1)*R), 29 (R=715827881, W=2^28*(2^31-1)*R)
%e 61 : 57 (R=153722867280912929, W=2^56*(2^61-1)*R)
%e 89 : 78 (R=302379100949042568368129, W=2^77*(2^89-1)*R)
%e 107 through 86243 : none.
%e 107 through 3021377: none. _Robert Price_, Sep 05 2019
%e The present sequence lists the number of k's in each line.
%t A000043 = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607,
%t 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937,
%t 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433,
%t 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011,
%t 24036583, 25964951, 30402457, 32582657, 37156667, 42643801,
%t 43112609};
%t lst = {};
%t For[i = 1, i <= 28, i++,
%t p = A000043[[i]];
%t kc = 0;
%t For[k = 1, k < p, k++,
%t r = 2^k - 1 + (2^k - 2)/(2^(p - k) - 1);
%t If[! IntegerQ[r], Continue[]];
%t If[PrimeQ[r], kc++]];
%t AppendTo[lst, kc]];
%t lst (* _Robert Price_, Sep 05 2019 *)
%o (PARI) A242998(n,p=A000043[n])={sum(k=p\2+1, p-1, Mod(2, 2^(p-k)-1)^k==2 && ispseudoprime(2^k-1+(2^k-2)/(2^(p-k)-1)))}
%Y Cf. A258882 (PWN of the form 2^k*p*q), A000043 (Mersenne prime exponents), A000668.
%Y Cf. A242025 (the primes R).
%Y Row lengths of A242999 (values of p) and A243003 (values of k), cf. A242993 for the smallest possible k.
%Y See also A320875 for more general solutions to R = (MQ-1)/(Q-M) = prime.
%K nonn,hard,more
%O 1,4
%A _M. F. Hasler_, Aug 17 2014
%E Typo in definition corrected by _Jens Kruse Andersen_, Aug 27 2014
%E a(29)-a(37) from _Robert Price_, Sep 05 2019