[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A131377 Starting with 1, the sequence a(n) changes from 1 to 0 or back when the next number n is a prime. 2

%I #11 Aug 15 2023 07:44:57

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

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

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

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

%F a(n) = 1 - A071986(n).

%e n = 0, 1, 2, 3, 4, 5, etc..

%e a(n)= 1, 1, 0, 1, 1, 0, etc.

%e Starting with 1 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 P:=proc(n) local i,k; k:=1; 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);

%Y Cf. A131378.

%Y Cf. A071986. - _Omar E. Pol_, Feb 19 2011

%K easy,nonn

%O 0,1

%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Jul 04 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 30 07:09 EDT 2024. Contains 375532 sequences. (Running on oeis4.)