I probably figured out the logic.
If you cut the links till the nearest power of 2 & the remaining difference.
For instance: cut 21 into 2^0, 2^1, 2^2, 2^3, 21-(sum of all links broken) which gives 21 = (1,2,4,8,6)
Similarly for 7 = (1,2,4).
This is probably b'coz in bit representation you might be able to produce all the numbers upto 2^n, if you have the links as 2^i (0<=i<=n-1)
Now in case of 21, the highest power of 2 is 16. So, we break into 1,2,4,8. Now the next cannot be 16 since the sum shall exceed 21 (i.e. 1+2+4+8+16 = 31 > 21). The remaining is 21-(1+2+4+8) = 6.
Now for digits after 16 and until 21 can be considered as 16+(1), 16+(2), 16+(3), 16+(4), 16+(5). Now each of the numbers in brackets viz. 1,2,3,4,5 can already be developed using links produced. And since the sum of all links is 21, the remaining can be used to form 16.