login
A181515
Greatest k < n such that 3^n - 3^k - 1 is prime, or 0 if no such prime exists.
4
0, 1, 2, 3, 2, 4, 0, 7, 8, 4, 7, 10, 12, 7, 10, 12, 13, 15, 17, 17, 20, 16, 15, 23, 17, 8, 3, 27, 24, 22, 19, 23, 25, 23, 30, 35, 13, 31, 22, 30, 21, 39, 17, 37, 32, 40, 42, 45, 45, 43, 45, 50, 50, 48, 34, 53, 56, 0, 54, 25
OFFSET
1,3
MAPLE
A181515:= proc(n) local p, k; for k from n-1 to 1 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
Table[Max[Flatten[Position[3^n-3^Range[n-1]-1, _?PrimeQ]]], {n, 60}]/.-\[Infinity]->0 (*Harvey P. Dale,Feb 12 2011 *)
KEYWORD
nonn
AUTHOR
Pierre CAMI,Jan 29 2011
STATUS
approved