def judgement(seed_a, seed_b):
    """Return amount of times last 16 binary digits of generators match."""
    sample = 0
    count = 0
    while sample <= 40000000:
        new_a = seed_a * 16807 % 2147483647
        new_b = seed_b * 48271 % 2147483647

        bin_a = bin(new_a)
        bin_b = bin(new_b)

        last16_a = bin_a[-16:]
        last16_b = bin_b[-16:]

        if last16_a == last16_b:
            count += 1

        seed_a = new_a
        seed_b = new_b
        sample += 1

    return count