login
a(n) = 1 if n-th prime is 0 or 2 mod 3, otherwise 0.
2

%I #29 Sep 08 2022 08:45:31

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

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

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

%N a(n) = 1 if n-th prime is 0 or 2 mod 3, otherwise 0.

%C Equivalently, a(n) = 0 if n-th prime is 1 mod 3, otherwise 1. - _Wouter Meeussen_, May 21 2019

%C Binary sequence based on the primes: play it at a slower tempo to appreciate the irregularities.

%H G. C. Greubel, <a href="/A132194/b132194.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 1-A099618(n). - _R. J. Mathar_, Jun 06 2019

%p a := n -> 1 - irem(modp(ithprime(n), 3), 2):

%p seq(a(n), n = 1..105); # _Peter Luschny_, May 21 2019

%t Table[If[Mod[Prime[n],3]== 1,0,1],{n,200}] (* _Harvey P. Dale_, May 21 2019 *)

%o (PARI) {a(n) = if(prime(n)%3==1, 0, 1)}; \\ _G. C. Greubel_, May 21 2019

%o (Magma) [(NthPrime(n) mod 3) eq 1 select 0 else 1: n in [1..200]]; // _G. C. Greubel_, May 21 2019

%o (Sage)

%o def a(n):

%o if (mod(nth_prime(n), 3)==1): return 0

%o else: return 1

%o [a(n) for n in (1..200)] # _G. C. Greubel_, May 21 2019

%Y Cf. A039701, A130198, A099618.

%K nonn,easy

%O 1,1

%A _Roger L. Bagula_, Nov 05 2007

%E Definition corrected by _Harvey P. Dale_, May 21 2019