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”).
%I #51 Jan 29 2018 03:26:06
%S 0,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,
%T 0,1,0,0,0,1,1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,
%U 1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1
%N Characteristic function of primes in the nonmultiples of 3.
%F From _David A. Corneth_, Dec 03 2017: (Start)
%F a(n) = A010051(A001651(n)).
%F a(n) = 1 if (6n - 3 - (-1)^n)/4 is prime, otherwise a(n) = 0. (End)
%e a(2) = 1 because the 2nd nonmultiple of 3 is 2, which is prime.
%p f:= n -> charfcn[{true}](isprime(floor((3*n-1)/2))):
%p map(f, [$1..1000]); # _Robert Israel_, Jan 24 2018
%t Array[Boole@ PrimeQ@ Floor[(3 # - 1)/2] &, 105] (* _Michael De Vlieger_, Dec 03 2017 *)
%o (PARI) a(n) = isprime(floor((3*n-1)/2)) \\ _Iain Fox_, Dec 03 2017
%o (PARI) first(n) = {my(inc = t = 1, res = vector(n)); for(i = 1, n, res[i] = isprime(t); t += inc; inc = 3-inc); res} \\ _David A. Corneth_, Dec 03 2017
%Y Cf. A001651, A010051, A045344.
%K nonn
%O 1
%A _Martin Michael Musatov_, Dec 03 2017