Let the top layer have m pipes. The layers, from the top down, have m,m+1,…,20 pipes. This is 1+2+⋯+20 with 1+2+⋯+(m−1) taken away:
S20−Sm−1=155
S20=220×21=210,so Sm−1=210−155=55
Since S10=210×11=55, we get m−1=10, so m=11.
(i) The layers have 11, 12, …, 20 pipes, so the number of layers is 20−11+1=10: the pile has 10 layers.
(ii) The top layer has 11 pipes.
Check with Āryabhaṭa's rule: 211+20×10=15.5×10=155 pipes.