Imagine I have 8 pack of coins now, each pack of coins contain 1, 3 , 9 , 27 ,81,243,729, 2187 respectively. Now given double-pan balance scale, given a pack of N coins( N only can be 1 - 3280) put on the left side pan, I need to write an ALGORITHM by using the 8 pack coins to determine number of N coins on the left. I can put the 8 pack coins on the left pan or right pan.
So far, i figure out 1,3,9,27,81.. is actually a ternary number system(3^n). And also to find N, i need to make the both pan to balance.
Beside i saw the pattern of remove coin 1,next step wiil be adding coin 1 to right. Eg.
Left Right
1+3+5 ; 9 (N = 5)
3+6 ; 9 (remove coin 1 from left) (N=6)
7 ; 1+9 (adding coin 1 from right) (N=7)
This repeated algorithm can be used for N=3,4; 6,7; 9,10; 12,13; 15,16....
Unfortunately, i can't determine the pattern of N =1,2,5,8,11,14,17...Is too random when it include more than 3 pack of coin.. I can't write the algorithm if I can't found out this.
Please help me~~~
