OFFSET
1,1
COMMENTS
The ratio (Sum_(n=1..t) a(n)) / (Sum_(n=1..t) n) tends to log(3) as t increases.
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..4000
MAPLE
f:= proc(n) local i, j, k, t;
t:= 3^n;
for i from 0 do
for j in [2, 4] do
if isprime((6*i+j)*t+1) then return 6*i+j fi
od od
end proc:
map(f, [$1..100]); # Robert Israel, Dec 14 2017
MATHEMATICA
f[n_] := Block[{k = 2}, While[If[Mod[k, 3] == 0, k+=2]; ! PrimeQ[k*3^n + 1], k+=2]; k]; Array[f, 65] (* Robert G. Wilson v, Dec 12 2017 *)
PROG
(PARI) a(n) = {k = 1; while (!isprime(k*3^n+1), k++; if (! (k%3), k++)); k; } \\ Michel Marcus, Nov 25 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Nov 25 2017
STATUS
approved