Do you know that Pingala has assigned the combinations of zero and one to represent various numbers, much in the same way as the present day computer programming procedures?
Pingala is the author of Chandaḥśāstra (Chandaḥsūtra), the earliest known Sanskrit treatise on prosody. His work, Chandaḥśāstra means science of meters, is a treatise on music and can be dated back to 2nd century BCE. Pingala’s system of binary numbers starts with number one (and not zero). The numerical value is obtained by adding one to the sum of place values. In this system, the place value increases to the right, as against the modern notation in which it increases towards the left.
The procedure of Pingala system is as follows:
- Divide the number by 2. If divisible write 1, otherwise write 0.
- If first division yields 1 as remainder, add 1 and divide again by 2. If fully divisible, write 1, otherwise write 0 to the right of first 1.
- If first division yields 0 as remainder that is, it is fully divisible, add 1 to the remaining number and divide by 2. If divisible, write 1, otherwise write 0 to the right of first 0.
- This procedure is continued until 0 as final remainder is obtained.
Chandaḥśāstra (8.24-25) describes above method of obtaining binary equivalent of any decimal number in detail.