Sum of indices of second least significant bit
k [21 chars]

{+/{(&amp;|0b\:x)1}'!x+1}


Example

{+/{(&amp;|0b\:x)1}'!x+1}[3]
1

{+/{(&amp;|0b\:x)1}'!x+1}[7]
6

{+/{(&amp;|0b\:x)1}'!x+1}[10]
12

{+/{(&amp;|0b\:x)1}'!x+1}[500]
1410