

A181537


Greatest k <= n such that 3^n + 3^k + 1 is prime or 0 if no such prime exists.


1



1, 2, 2, 4, 5, 6, 6, 2, 9, 6, 9, 0, 9, 12, 14, 16, 17, 15, 10, 18, 18, 13, 9, 22, 21, 18, 21, 16, 0, 30, 24, 11, 29, 9, 26, 32, 18, 15, 34, 39, 29, 37, 24, 27, 33, 31, 0, 30, 30, 15, 40, 43, 35, 54, 45, 42, 57, 51, 8, 60
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS

Pierre CAMI, Table of n, a(n) for n = 1..2000


MAPLE

A181537 := proc(n) local p, k; for k from n to 0 by 1 do p := 3^n+3^k+1 ; if isprime(p) then return k; end if; end do: return 0 ; end proc: # R. J. Mathar, Jan 30 2011


MATHEMATICA

gk[n_]:=Module[{k=n, t=3^n+1}, While[!PrimeQ[t+3^k]&&k>0, k]; k]; Array[ gk, 60] (* Harvey P. Dale, Jan 30 2019 *)


CROSSREFS

Cf. A181530.
Sequence in context: A010848 A133937 A181523 * A130498 A263433 A147806
Adjacent sequences: A181534 A181535 A181536 * A181538 A181539 A181540


KEYWORD

nonn


AUTHOR

Pierre CAMI, Jan 29 2011


STATUS

approved



