The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

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

%I

%S 0,1,2,2,4,5,6,4,7,9,6,10,3,10,12,0,16,17,12,17,12,3,20,22,21,17,22,0,

%T 0,22,30,29,11,31,32,18,17,35,35,37,12,25,38,14,15,12,42,37,35,42,42,

%U 36,40,52,54,16,48,57,35,58

%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="/A181523/b181523.txt">Table of n, a(n) for n = 1..2000</a>

%p A181523 := proc(n) local p,k; for k from n-1 to 0 by -1 do p := 3^n-3^k+1 ;

%p if isprime(p) then return k; end if; end do: return 0 ; end proc:

%p seq(A181523(n),n=1..80) ; # _R. J. Mathar_, Jan 31 2011

%o (Sage)

%o A181523 = lambda n: next((k for k in reversed(IntegerRange(1,n)) if is_pseudoprime(3^n-3^k+1)), 0) # _D. S. McNeil_, Jan 31 2011

%Y Cf. A181515.

%K nonn

%O 1,3

%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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified July 31 17:51 EDT 2021. Contains 346376 sequences. (Running on oeis4.)