Counter game

  • + 1 comment

    Python3 1 liner:

    return ('Louise', 'Richard')[(n.bit_count() + int(math.log2(n & -n))) % 2]
    #or
    return ('Richard', 'Louise')[(n.bit_count() + (n & -n).bit_length()) % 2]