A291437 Smallest m >= 0 such that (2*n)*3^m + 1 is prime, or -1 if no such value exists.
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, 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, 0, 1, 2, 1, 1, 0, 0, 1, 1, 0, 2, 80, 0, 6, 0, 8, 2, 0, 1
Offset: 1
Keywords
Examples
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.
Programs
-
Maple
a:=[]: for n from 1 to 10^3 do t:=-1: for m from 0 to 10^3 do # this max value of m is sufficient up to n=10^3 if isprime((2*n)*3^m+1) then t:=m: break: fi: od: a:=[op(a),t]: od: a;
-
Mathematica
Table[SelectFirst[Range[0, 10^3], PrimeQ[2 n*3^# + 1] &] /. k_ /; MissingQ@ k -> -1, {n, 104}] (* Michael De Vlieger, Aug 23 2017 *)
-
PARI
a(n) = {my(m = 0); while (!isprime(p=(2*n)*3^m + 1), m++); m;} \\ Michel Marcus, Aug 25 2017
Comments