OFFSET
1,1
COMMENTS
An evil number (A001969) is a nonnegative integer with an even number of ones in its binary expansion.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
Chris Bernhardt, Evil twins alternate with odious twins, Math. Mag. 82 (2009), pp. 57-62; also on JSTOR.
Eric Weisstein's World of Mathematics, Odious Number
EXAMPLE
The sequence of evil numbers (A001969) begins 0,3,5,6,9,10,12,15,17,18,20,..., so the first few evil twins are 5, 9, 17, ... .
MATHEMATICA
SequencePosition[Table[If[EvenQ[DigitCount[n, 2, 1]], 1, 0], {n, 300}], {1, 1}][[All, 1]] (* Amiram Eldar, Dec 09 2019 after Harvey P. Dale at A157971 *)
PROG
(PARI) lista(nn) = select(n->(!(hammingweight(n) % 2) && !(hammingweight(n+1) % 2)), vector(nn, i, i)); \\ Michel Marcus, Jul 10 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Mar 10 2009
STATUS
approved