How on earth did llhuii output the Evil Numbers in 42 bytes of Python? This is a tips question for golfing in Python concerning the Evil Numbers question on Anarchy Golf. 

An number is evil if its binary expansion has an even number of 1's. The challenge is to print the first 400 evil numbers 0,3,5,...,795,797,798, one per line.

The Python 2 submissions are led by llhuii with a 42-byte solution. The next best is 46 bytes by mitchs, followed by five 47-byte submissions. It seems llhuii has found something truly magical that has eluded many strong Python golfers for over 2 years. Saving 4 or 5 bytes is huge for such a short golf.



I'm still at 47 bytes. I'm hoping we can crack this puzzle as a community. If we get an answer jointly, I'd submit it under the names of everyone who contributed. An answer to this question can be a piece of code or a new idea or a piece of analysis. If you are llhuii, please don't spoil it for us yet.

Though submissions are not revealed because this problem is Endless, we're given some leads. The winning submission took 0.1699 seconds to run, much longer than any other, suggesting an inefficient method. From the byte statistics, of the 42 characters, 23 are alphanumeric [0-9A-Za-z] and 19 are ASCII symbols. This means there is no whitespace in llhuii's solution.

You can test your code on the problem page, choosing Python from the language dropdown or uploading a .py file. Note that:


Python 2.7 is used
Your code must be a full program that prints
There's no input for this problem, like kolmogorov-complexity
Your program just has to print the 400 values as given, even if it would break on larger values
Programs have 2 seconds to run
Programs may terminate with error
You may use exec; the "exec is denied" refers to shell exec
This isn't the same solution as llhuii's, but it's also 42 bytes long.



n=0;exec'print n;n^=(n^n+2)%3/2;n+=2;'*400


Try it online!

Thanks to @JonathanFrech, we're now at 40 bytes.

n=0;exec'print n;n=n+2^(n^n+2)/2%3;'*400


Try it online!

There's another byte to be saved, for a total of 39.

n=0;exec'print n;n=n+2^-(n^n+2)%3;'*400


Try it online!