login
Evilness of triangular numbers.
0

%I #5 Nov 17 2018 12:09:40

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

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

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

%N Evilness of triangular numbers.

%C The evilness of a number is 1 if the number is evil and 0 otherwise. The number is evil if it has an even number of ones in its binary expansion.

%t od[n_] := Mod[Count[IntegerDigits[n, 2], 1], 2] Table[1 - od[n (n + 1)/2], {n, 0, 128}]

%t If[EvenQ[DigitCount[#,2,1]],1,0]&/@Accumulate[Range[0,110]] (* _Harvey P. Dale_, Nov 17 2018 *)

%Y A000217 Triangular numbers. A001969 Evil numbers.

%K nonn

%O 0,1

%A _Tanya Khovanova_, Dec 29 2008