SG function + some imagination (so called, YY)

```
def mex(l):
i = 0
while True:
if i not in l:
return i
i += 1
class Solution(object):
def canWinNim(self, n):
sg = [0]
for i in xrange(1, n + 1):
l = []
for j in [1, 2, 3]:
if i - j >= 0:
l.append(sg[i - j])
sg.append(mex(l))
return sg[-1] != 0
S = Solution()
for i in xrange(100):
print i, S.canWinNim(i)
```

then luckily I found that "n % 4 != 0" is the answer

What a good day!