%I #20 Aug 26 2017 02:50:15
%S 0,0,0,2,0,0,1,0,0,1,0,1,1,0,0,1,1,0,4,0,0,2,0,2,1,0,1,9,0,0,4,1,0,2,
%T 0,0,1,1,0,1,0,2,4,0,1,1,1,0,2,0,0,1,0,0,1,0,3,1,2,4,1,1,0,2,0,1,5,0,
%U 0,1,2,1,1,0,0,1,1,0,2,80,0,6,0,8,2,0,1
%N Smallest m >= 0 such that (2*n)*3^m + 1 is prime, or -1 if no such value exists.
%C There exist even integers 2*n such that (2*n)*3^m + 1 is always composite.
%C It is conjectured that the smallest one is 125050976086 = A123159(3), therefore a(62525488043) = -1.
%C For the corresponding primes see A291438.
%C a(A005097(n)) = 0 and a(A047845(n+1)) > 0 (or = -1).
%e a(4) = 2 because this is the smallest value such that 8*3^2 + 1 = 73 is prime, since 8*3^0 + 1 = 9 and 8*3^1 + 1 = 25 are not prime.
%p a:=[]:
%p for n from 1 to 10^3 do
%p t:=-1:
%p for m from 0 to 10^3 do # this max value of m is sufficient up to n=10^3
%p if isprime((2*n)*3^m+1) then t:=m: break: fi:
%p od:
%p a:=[op(a),t]:
%p od:
%p a;
%t Table[SelectFirst[Range[0, 10^3], PrimeQ[2 n*3^# + 1] &] /. k_ /; MissingQ@ k -> -1, {n, 104}] (* _Michael De Vlieger_, Aug 23 2017 *)
%o (PARI) a(n) = {my(m = 0); while (!isprime(p=(2*n)*3^m + 1), m++); m;} \\ _Michel Marcus_, Aug 25 2017
%Y Cf. A005097, A046067, A047845, A123159, A291438.
%K nonn
%O 1,4
%A _Martin Renner_, Aug 23 2017