Triangle case:
If the triangle has three weights, we can subtract the smallest value from each side. That reduces to the case of only two unknown weights and a zero in the third pan.
The original problem defines the maximum weight as 40. Rather than examine this exact case, I assume an arbitrarily large MAX weight and solved for that. This will give an optimal solution for arbitrarily large MAX, but for specific values (such as 40) it may merely give a very good solution rather than an optimal one.
There's a particularly good solution I want to mention, which doesn't quite fit the rules. You can balance the two unknown weights using a single set of 3^n weights as in the solution for the original problem, then fill the empty pan using a single set of 2^n weights. This efficiently uses fewer weights in total, but requires two differing sets of weights.
To solve this problem we are going to be working in some base x, and assume each weight is a number written in base x. When solving any particular case we will work on it one digit at a time, starting from the smallest digit. If we can balance the triangle for the smallest digit, then we simply repeat the same process to solve each larger digit. Note that because the process is the same for each digit, we only need to ensure that our process works for the smallest digit. If it works for one digit it will work for every digit.
This means that for x=2, we only need to examine the cases where the weights are 0,0 0,1 1,0 and 1,1. For X=3 we only need to examine the cases where the weights are 0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 and 2,2. Similarly for x=4 we only need to examine the 16 cases with weights ranging up to 3,3. If that works we can solve the lowest digit and the process can repeat to solve every digit.
When x=2 the worst case is when the unknown weights are 0,1. We can add 1 to the second pan - this changes it into a 0 and a carry into the next digit. This results in 0,0,0 for the lowest digit in each pan. (We don't care about the carry, it gets absorbed into the next digit and solved when we handle that digit.) We only need 1 of each size weight.
When x=3 the worst case is when the unknown weights are 1,2. We will need 2,2,2 to balance the triangle, meaning we will need 3 of each size weight.
When x=4 the worst case is when the unknown weights are 1,3. The most efficient solution is to add 3 to the first pan and 1 to the second pan. This means we'll have 0,0,0 as the lowest digit in each pan, and the weights generate a carry into the next digit. This means we need 4 of each size weight.
When x=5 the worst case is when the unknown weights are 1,3. The most efficient solution is to add 2 to the first pan and 3 to the empty pan. This means we need 5 of each size weight. And things just get worse for larger x.
So which is the most efficient x?
For x=2 we will need 1 weight of each size, times LogBase2(MAX) sized-weights.
For x=3 we will need 3 weights of each size, times LogBase3(MAX) sized-weights.
For x=4 we will need 4 weights of each size, times LogBase4(MAX) sized-weights.
For x=5 we will need 5 weights of each size, times LogBase5(MAX) sized-weights.
For an arbitrarily large MAX value, lower is better:
x=2 has an efficiency of 1/Ln(2)=1.4427
x=3 has an efficiency of 3/Ln(3)=2.7307
x=4 has an efficiency of 4/Ln(4)=2.8854
x=5 has an efficiency of 5/Ln(4)=3.1067
For arbitrarily large MAX weight best solution is x=2, with one copy of each weight.
For the tetrahedron yet the reasoning is essentially the same. We'll have three unknown weights, and we only need to find how many weights are needed to solve a single digit in the worst case.
For x=2 the worst case is 0,1,1. We need 2 weights to balance that as 1,1,1,1.
For x=3 the worst case is 1,1,2. We need 4 weights to balance that as 2,2,2,2.
For x=4 the worst case is 1,1,3. We need 7 weights to balance that as 3,3,3,3.
For an arbitrarily large MAX value, lower is better:
x=2 has an efficiency of 2/Ln(2)=2.8854
x=3 has an efficiency of 4/Ln(3)=3.6410
x=4 has an efficiency of 7/Ln(4)=5.0494 and clearly worse for higher X.
For a tetrahedron the most efficient is x=2 with 2 copies of each weight.