Find all such that and have the same number of 1's in their binary representation for any .
Solutions — 2
Solution 1
We claim that all such functions are of the form for some natural number . The verification is trivial; now consider some function satisfying the given condition. For , let denote the number of 1's in the binary representation of . Let denote the statement that and have the same number of 1's in their binary representation.
Claim 1 For any with , is a power of two.
Proof. gives us that and have the same number of 1's, and the former has exactly one 1, so has exactly one 1, from which the claim follows.
Claim 2 is a power of two for any and .
Proof. Choose an such that . By Claim 1, for some with . Therefore gives
since . If , then LHS is , contradiction! If , and has digits, then
since starts with at least ones, contradiction! Therefore , and since is bigger than the number of digits in , there is no carry-over, so
which gives us is a power of 2, as required
Claim 2 gives us for some , for all . But for , is also a power of two is a power of two, which is only possible if for all . Therefore is a constant power of two for all , say . This gives us for some constant , for all . Putting this in Claim 1, we get
is a power of two for any and any sufficiently large . This is only possible if, for all ,
which can only hold for all if , i.e., for all . But Claim 1 for and large gives
is a power of two for all sufficiently large , which is only possible if . Therefore for all .
Solution 2
We claim that all such functions are of the form for some natural number . The verification is trivial; now consider some function satisfying the given condition. For , let denote the number of 1's in the binary representation of .
Claim 1 Given any , there exists so that .
Proof. Suppose that there is so that for all . Let be such that . Note that . The right hand side is at least which the left hand side is at most , a contradiction. This proves our claim.
Claim 2 The function is injective.
Proof. Suppose there are so that . Then, for any natural number with , we have . This implies for some . Similarly for some . This implies that . Therefore exist unique and such that for all natural numbers with . Let be a natural number such that , which exists by the previous lemma. Let be such that (note that this ensures ). Then , but . This is a contradiction because
Thus must be injective.
Now let be natural numbers so that . As in the proof of the previous lemma, for any natural number with we have for some .
Claim 3 There exists a natural number such that for all , we have .
Proof. Suppose the contrary. Let be distinct natural numbers so that . Further choose distinct different from and , so that . Then
Since is injective, we may further assume . Note that if is such that , then . Thus equation (1) cannot hold, proving our claim.
Let be a natural number such that and . Note that
If then , and so we must have . On the other hand, if , then , and hence , a contradiction. Thus .
Letting , we have shown that implies , and that there are arbitrarily large integers so that . It is now clear by induction that for all .