@RaphX Well you can look at the binary representation of n. First prove that adding a power of 2 would increase the number of ones in the binary representation by at most 1. So if n in binary has more than 4 ones then there is no solution. If it has 4 ones, clearly only 1 solution. If 3 ones, 1 of the ones must be from 2 powers of two. If 2 ones, ...