cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A131378 Starting with 0, the sequence a(n) changes from 0 to 1 or back when the next number n is a prime.

This page as a plain text file.
%I A131378 #14 Jul 23 2019 08:52:03
%S A131378 0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,0,1,1,1,
%T A131378 1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,
%U A131378 1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1
%N A131378 Starting with 0, the sequence a(n) changes from 0 to 1 or back when the next number n is a prime.
%C A131378 Zero together with A071986. - _Omar E. Pol_, Feb 19 2011
%C A131378 Parity of A230980. - _Omar E. Pol_, Jul 19 2019
%e A131378 n = 0, 1, 2, 3, 4, 5, etc.
%e A131378 a(n)= 0, 0, 1, 0, 0, 1, etc.
%e A131378 Starting with 0 the sequence changes when we move from 1 to 2 because 2 is prime, again from 2 to 3 because also 3 is prime, then from 4 to 5 being 5 prime and so on.
%p A131378 P:=proc(n) local i,k; k:=0; for i from 0 by 1 to n do if isprime(i) then if k=1 then k:=0; else k:=1; fi; fi; print(k); od; end: P(100);
%t A131378 nxt[{n_,a_}]:={n+1,Which[a==0&&PrimeQ[n+1],1,a==1&&PrimeQ[n+1],0,True,a]}; NestList[nxt,{0,0},100][[All,2]] (* _Harvey P. Dale_, Jul 19 2019 *)
%Y A131378 Cf. A131377.
%Y A131378 Cf. A071986. - _Omar E. Pol_, Feb 19 2011
%K A131378 easy,nonn
%O A131378 0,1
%A A131378 _Paolo P. Lava_ and _Giorgio Balzarotti_, Jul 04 2007