In this challenge you will be asked to implement any function (or full program) that fulfills two properties. Those properties are:
Your function must be an injective (reversible) function from the polynomials with non-negative integer coeffecients to the non-negative integers. This means no two unequal inputs can map to an equal output.
Your function must preserve the total number of "on bits" from its input to its output. This means if you count the 1 bits of each coefficient of the polynomial, their sum should be the same as the number of 1 bits in the binary representation of the output. For example
1001in binary so it has 2
A non-negative integer polynomial is the same as a infinite list of non-negative integers such that after a certain point all the integers are zero. Thus, polynomials may be represented either by infinite lists (although this is probably undesirable) or by finite lists with implicit zeros after the end of the list.
The key distinction between polynomials and finite lists is that adding a zero to the end of a list will change the list:
While adding a zero to the end of a polynomial does not change its value:
Thus if your function takes a finite list representing a polynomial as input, adding a zero must not change its result.
When representing polynomials as lists, you may represent them either with the first or last entry representing the constant term. For example you could have either of the following possibilities:
In the first case, adding zeros to the end of the list should not change the result; in the second case, adding zeros to the front of the list should not change the result.
Of course if your language supports polynomials you may take those as inputs.
Output should be a non-negative integer output via any standard methods.
This is code-golf so answers will be scored in bytes, with fewer bytes being better.