OFFSET
1,1
COMMENTS
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..1000
EXAMPLE
a(4) = 73 because 8*3^2 + 1 = 73 is the smallest prime of this form, since 8*3^0 + 1 = 9 and 8*3^1 + 1 = 25 are not prime.
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), (2*n)*3^t+1]:
od:
a;
MATHEMATICA
Table[If[# < 0, #, 1 + 2 n*3^#] &@ SelectFirst[Range[0, 10^3], PrimeQ[2 n*3^# + 1] &] /. k_ /; MissingQ@ k -> -1, {n, 60}] (* Michael De Vlieger, Aug 23 2017 *)
PROG
(PARI) a(n) = {my(m = 0); while (!isprime(p=(2*n)*3^m + 1), m++); p; } \\ Michel Marcus, Aug 25 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Martin Renner, Aug 23 2017
STATUS
approved