%I #39 Sep 21 2024 12:39:38
%S 2,1,0,0,2,0,1,0,1,1,2,0,3,0,1,1,2,0,1,0,1,1,4,0,3,2,1,3,4,0,1,0,2,1,
%T 2,1,1,0,3,1,2,0,7,0,1,3,4,0,1,2,1,1,2,0,1,2,1,3,12,0,3,0,2,1,4,1,5,0,
%U 1,1,2,0,7,0,1,1,2,2,1,0,3,1,2,0,5,6,1,23,4,0,1,2,3,3,2,1,1,0,1,1,10,0,3
%N Riesel problem: a(n) = smallest m >= 0 such that n*2^m-1 is prime, or -1 if no such prime exists.
%H Eric Chen, <a href="/A040081/b040081.txt">Table of n, a(n) for n = 1..2292</a> (first 1000 terms from T. D. Noe)
%H Hans Riesel, <a href="/A076337/a076337.pdf">Some large prime numbers</a>. Translated from the Swedish original (NĂ¥gra stora primtal, Elementa 39 (1956), pp. 258-260) by Lars Blomberg.
%t Table[m = 0; While[! PrimeQ[n*2^m - 1], m++]; m, {n, 100}] (* _Arkadiusz Wesolowski_, Sep 04 2011 *)
%o (Haskell)
%o a040081 = length . takeWhile ((== 0) . a010051) .
%o iterate ((+ 1) . (* 2)) . (subtract 1)
%o -- _Reinhard Zumkeller_, Mar 05 2012
%o (PARI) a(n)=for(k=0,2^16,if(ispseudoprime(n*2^k-1), return(k))) \\ _Eric Chen_, Jun 01 2015
%o (Python)
%o from sympy import isprime
%o def a(n):
%o m = 0
%o while not isprime(n*2**m - 1): m += 1
%o return m
%o print([a(n) for n in range(1, 88)]) # _Michael S. Branicky_, Feb 01 2021
%Y Main sequences for Riesel problem: A038699, A040081, A046069, A050412, A052333, A076337, A101036, A108129.
%Y Cf. A010051, A000079.
%K nonn
%O 1,1
%A _David W. Wilson_