Q:

What is the 30th number in the sequence?

What is the 30th number in the following sequence?

0, 2, 4, 12, 8, 20, 24, 56, 16, 36, ...

I'm not sure what would be good hints, or how much further out I should list the sequence. I figure the first ten values should be a good start, but I can add or confirm more if needed.
BTW, The first six are sufficient to show that this sequence does not appear on the Online Encyclopedia of Integer Sequences.

A:

I would say that the 30th number in the sequence is:

 $464$

Explanation:

 Let $H(n)$ be the Hamming weight of a number $n$, where the 
 Hamming weight is the sum of all the 1s in the binary representation of $n$.

 Starting with $n = 0$, each number in the sequence $S(n)$ is $n \times 2^{H(n)}$.

 For example, for $n = 5$, the binary representation of $5$ is $101$, and $H(5)$
 is $2$.  Thus the 6th element in the sequence is $5 \times 2^2 = 20. $

 By this logic, the 30th element of the sequence has $n = 29$.  The binary representation of $29$ is $11101$, so $H(29)$ is $4$.  Thus the 30th element is $29 \times 2^4 = 464$. 

