Skip to main content
added 2 characters in body
Source Link
Martin Sleziak
  • 4.7k
  • 4
  • 35
  • 40

This is inspired by answers in the other linked threads. You can let $f(S') = \sum_{x_j \in S'} 2^{j-1}$.

If you let your set only contain powers of 2, i.e. $S = \{ 1, 2, 4, 8, \ldots , 2^i\}$, then $f(S') = \sum_{x_j \in S'} x_j$, the sum of all numbers in S'$S'$.

Note that this is the same as interpreting $S'$ as a length $i$ binary number where the $j$th bit is 1 if $x_j \in S'$ and 0 otherwise. Note that there are $2^i$ different subsets of $S$ so you need a binary number of length at least $i$ to be able to represent all possible subsets.

This is inspired by answers in the other linked threads. You can let $f(S') = \sum_{x_j \in S'} 2^{j-1}$.

If you let your set only contain powers of 2, i.e. $S = \{ 1, 2, 4, 8, \ldots , 2^i\}$, then $f(S') = \sum_{x_j \in S'} x_j$, the sum of all numbers in S'.

Note that this is the same as interpreting $S'$ as a length $i$ binary number where the $j$th bit is 1 if $x_j \in S'$ and 0 otherwise. Note that there are $2^i$ different subsets of $S$ so you need a binary number of length at least $i$ to be able to represent all possible subsets.

This is inspired by answers in the other linked threads. You can let $f(S') = \sum_{x_j \in S'} 2^{j-1}$.

If you let your set only contain powers of 2, i.e. $S = \{ 1, 2, 4, 8, \ldots , 2^i\}$, then $f(S') = \sum_{x_j \in S'} x_j$, the sum of all numbers in $S'$.

Note that this is the same as interpreting $S'$ as a length $i$ binary number where the $j$th bit is 1 if $x_j \in S'$ and 0 otherwise. Note that there are $2^i$ different subsets of $S$ so you need a binary number of length at least $i$ to be able to represent all possible subsets.

Source Link

This is inspired by answers in the other linked threads. You can let $f(S') = \sum_{x_j \in S'} 2^{j-1}$.

If you let your set only contain powers of 2, i.e. $S = \{ 1, 2, 4, 8, \ldots , 2^i\}$, then $f(S') = \sum_{x_j \in S'} x_j$, the sum of all numbers in S'.

Note that this is the same as interpreting $S'$ as a length $i$ binary number where the $j$th bit is 1 if $x_j \in S'$ and 0 otherwise. Note that there are $2^i$ different subsets of $S$ so you need a binary number of length at least $i$ to be able to represent all possible subsets.