login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = 1 iff 6n-1 is prime.
6

%I #11 Sep 08 2022 08:45:48

%S 1,1,1,1,1,0,1,1,1,1,0,1,0,1,1,0,1,1,1,0,0,1,1,0,1,0,0,1,1,1,0,1,1,0,

%T 0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,0,0,1,1,0,0,0,0,1,1,1,0,0,0,1,1,0,1,0,

%U 0,1,0,1,0,1,1,0,1,1,0,1,0,1,0,1,1,0,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,0,0

%N a(n) = 1 iff 6n-1 is prime.

%H Vincenzo Librandi, <a href="/A167020/b167020.txt">Table of n, a(n) for n = 1..5000</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%e a(5) = 1 because 6*5-1 is prime, a(6) = 0 since 6*6-1 is composite.

%t Table[If[PrimeQ[6 n - 1], 1, 0], {n, 100}] (* _Vincenzo Librandi_, Jan 19 2019 *)

%o (PARI) a(n) = isprime(6*n-1); \\ _Michel Marcus_, Jan 19 2019

%o (Magma) [IsPrime(6*n-1) select 1 else 0: n in[1..100]]; // _Vincenzo Librandi_, Jan 19 2019

%Y Cf. A024898, A167021.

%K nonn

%O 1,1

%A _Washington Bomfim_, Oct 27 2009