[Solution] (1) Let the mass numbers of these k weights be a1,a2,⋯,ak, and 1⩽a1⩽a2⩽⋯⩽ak,ai∈Z,1⩽i⩽k. Since weights can be placed on both sides of the balance, the mass that can be measured is
∑i=1kxiai,xi∈{−1,0,1}.
If using these k weights can measure the mass of items that are 1,2,⋯,n, then the above representation includes 1,2,⋯,n. By symmetry, it is easy to see that it also includes −1,−2,⋯,−n. Therefore,
{i=1∑kxiai∣xi∈{−1,0,1}}⊇{0,±1,±2,⋯,±n}
Since the number of elements in the set {∑i=1kxiai∣xi∈{−1,0,1}} does not exceed 3k, and the set {0,±1,±2,⋯,±n} contains 2n+1 elements, therefore
3k⩾2n+1n⩽23k−1
If 23m−1−1<n⩽23m−1,(m⩾1,m∈Z), then k⩾m.
On the other hand, if 23m−1−1<n⩽23m−1,(m⩾1,m∈Z), then we can
take m weights: a1=1,a2=3,⋯,am=3m−1 to measure all items with mass 1,2,⋯,n grams.
In fact, by the ternary representation of numbers, for any 0⩽p⩽3m−1, there exist yi∈{0,1,2},1⩽i⩽m, such that
p=i=1∑′′yi3i−1
Thus, p−23m−1=∑i=1myi⋅3i−1−∑i=1m3i−1
=i=1∑m(yi−1)3i−1
Let l=p−23m−1, then −23m−1⩽l⩽23m−1;
Let xi=yi−1, then xi∈{−1,0,1}, thus, we have
l=i=1∑mxi⋅3i−1
Since n⩽23m−1, for any l∈{1,2,⋯,n}, there exist xi,1⩽i⩽m, such that
l=i=1∑mxi⋅3i−1=i=1∑mxiai
This means that using weights with mass 1,3,⋯,3m−1, we can measure all items with mass 1,2,⋯,n grams, where n⩽23m−1.
In summary, the minimum value of k is f(n)=m, where m satisfies the inequality 23m−1−1<n⩽23m−1.
(2) First, prove that when 23m−1−1<n<23m−1, the composition of f(n) weights, besides the one already mentioned in (1):
a1=1,a2=3,⋯,am=3m−1, there is at least one more way: a1=1,a2=3,⋯,am−1=3m−2,am=3m−1−1.
In fact, if 1⩽l⩽23m−1−1, then by (1), there exist xi∈{−1,0,1}, such that
l=∑i=1m−1xi⋅3i−1=∑i=1m−1xi⋅3i−1+0⋅(3m−1−1). If 23m−1−1<l⩽n<23m−1, then l+1⩽23m−1,
Thus, by (1), there exist xi∈{−1,0,1}, such that
l+1=i=1∑mxi⋅3i−1
And it must be that xm=1. Thus,
l=i=1∑m−1xi⋅3i−1+1⋅(3m−1−1)
Therefore, using weights a1=1,a2=3,⋯,am−1=3m−2,am=3m−1−1 can measure all items with mass 1,2,⋯,n grams. Thus, in this case, the composition of f(n) weights is not unique.
Next, prove that when n=23m−1, the composition of f(n) weights is unique, i.e., ai=3i−1(1⩽i⩽m).
In fact, if m weights a1,a2,⋯,am can measure all items with mass 1,2,⋯,n=23m−1 grams, then for each −23m−1⩽l⩽23m−1, there exist
l=i=1∑mxiai,xi∈{−1,0,1}
Therefore,
{i=1∑mxiai∣xi∈{−1,0,1}}⊇{0,±1,⋯,±23m−1}
Notice that the left-hand side set contains at most 3m elements, and the right-hand side set contains exactly 3m elements, thus, we have
{i=1∑mxiai∣xi∈{−1,0,1}}={0,±1,⋯,±23m−1}
And ∑i=1mai=23m−1
Adding 23m−1 to each element of the set, we get
{i=1∑mxiai+i=1∑mai∣x∈{−1,0,1}}={0,1,2,⋯,3m−1}
That is, {∑i=1myiai∣yi∈{0,1,2}}={0,1,2,⋯,3m−1}.
And for each l(0⩽l⩽3m−1), it can be uniquely represented as l=∑i=1myiai. Assume a1<a2<⋯<am. Therefore, a1 is the smallest positive integer in the set {0,1,2,⋯,3m−1}, i.e., a1=1. Assume a1=1,a2=3,⋯,as=3s−1. Then