login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A181537 Greatest k <= n such that 3^n + 3^k + 1 is prime or 0 if no such prime exists. 1

%I #16 Jan 30 2019 17:25:41

%S 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,

%T 16,0,30,24,11,29,9,26,32,18,15,34,39,29,37,24,27,33,31,0,30,30,15,40,

%U 43,35,54,45,42,57,51,8,60

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

%H Pierre CAMI, <a href="/A181537/b181537.txt">Table of n, a(n) for n = 1..2000</a>

%p 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

%t 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 *)

%Y Cf. A181530.

%K nonn

%O 1,2

%A _Pierre CAMI_, Jan 29 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 10:08 EDT 2024. Contains 375264 sequences. (Running on oeis4.)