If we try to run this, we would eventually get the flag, but it's really slow, so let's try to not do that.
If we take a look at the a() function, we can see that it
Has a loop that goes from 1 to n (for i in range)
Defines b to be 0
Checks if i is a multiple of n
If so, add i to b
If b is equal to n, return True
We can see (and also guessing by the title) that this will only return true on perfect numbers. Knowing this, I just looked up a list of perfect numbers, and then just XORed each number with the corresponding perfect number.
Script below.
Then we just wrap the output with flag and submit it