the least steps to remove all pebbles on table On the table there are 100 bags of pebbles that contain 1, 2, 3, 4, ...., 100 pebbles respectively. In one step you are allowed to reduce the number of pebbles of any number of the bags as long as you take the same number of pebbles from each bag you selected. What is the least number of steps you can take all the pebbles off the table?
 A: Write $X_n$ the minimum number of steps required to clear the table if the set of number of pebbles in the bags is $\{1,...,n\}$ (so two or more bags can contain the same number $k \le n$ of pebbles ; they will be cleared at the same time under any optimal strategy anyway).
If you take $m \le n$ pebbles off each bag with more than $m$ pebbles (I'm assuming any optimal strategy would take off as many pebbles as possible at each round but that intuition should be verified), you're left with bags containing between $1$ and $\max (m-1, n-m)$ pebbles (again several bags may contain the same number of p.) and clearing this new table should take $X_{\max (m-1, n-m)}$ steps. 
So $\displaystyle X_n = 1+ \min_{1 \le m \le n} X_{\max (m-1, n-m)}$. Given that $X_n$ is increasing (it has to be), the best cut-off $m$ should always be $m=\lceil \frac{n-1}{2} \rceil$ (I hope I got my floor/ceil right), so $X_n = 1 + X_{\lceil \frac{n-1}{2} \rceil}$.
So $X_{100} = 1 + X_{50} = 2 + X_{25} =$ ... $= 5 + X_3 = 6 + X_1 = 7$. 
Remove, in order, 50, 25, 12, 6, 3, 1 and 1.
Edit 
As indicated by @Pratik_Soni, the closed formula is $X_n = \lceil \log_2 (n+1) \rceil$.
A: Seven steps. Take 64 pebbles from each bag containing at least that much. Repeat for 32, 16, 8, 4,2 and 1.
