A problem from 600 CE and some curiosities of Āryabhaṭa’s kuṭṭaka algorithm

Around 600 CE in the examinations of one of the Hindu schools of mathematics and astronomy one might have encountered a problem such as below (given by Bhāskara-I in his commentary on Āryabhaṭa’s Āryabhaṭīya):

dvayādyaiḥ ṣaṭ-paryantair ekāgraḥ yo ‘vaśiṣyate rāśiḥ |
saptabhir eva sa śuddho vada śīghraṃ ko bhaved gaṇaka ||

Quickly say, O mathematician, which number when divided by the numbers starting with 2 and ending in 6 (i.e 2:6) leaves 1 as the remainder, and is exactly divisible by 7?

This problem was given to illustrate the use of the kuṭṭaka algorithm first provided by Āryabhaṭa. Before we actually solve the above problem we will briefly examine the kuṭṭaka. The kuṭṭaka is a general algorithm deployed to obtain integer solutions for the indeterminate linear equations of the form ax-by=c, where a, b, c are positive integers. Thus, it is essentially the problem of finding the coordinates of the the integer lattice point through which the line ax-by=c passes. Of the three constants in the equation, a and b are given; c is not given but we have to find the smallest c for which the equation can be solved in integers. From that we can build other valid c For computational simplicity (with no loss of generality) we take a to be the bigger number and b to be the smaller number. The below presentation of it follows the matrix representation of Āryabhaṭa’s operation given by the mathematician Avinash Sathye:

Let us consider as an example the following equation 95x-25y=c. From a=95 and b=25 we can generate the below matrix which is the result of the kuṭṭaka procedure. We have written a function ‘kuṭṭaka’ in the R language that computes this matrix and few other details given a,b.

K=\begin{bmatrix} 19 & 4 & 95 & NA \\ 5 & 1 & 25 & 3 \\ 4 & 1 & 20 & 1 \\ 1 & 0 & 5 & 4 \\ 0 & 1 & 0 & NA \\ \end{bmatrix}

The process is initiated with column K[,3]. Write K[1,3]=a and K[2,3]=b. Kuṭṭaka in Sanskrit means ‘to powder’, common translated as ‘pulverizer’. We start ‘pulverizing’ a=95 with b=25, which means finding the K[3,3]=K[1,3] \mod K[2,3]. Then K[4,3]=K[2,3] \mod K[3,3]. We iterate this procedure until we get K[n,3]=0; that completes the column K[,3]. We call n as the number of iterations for convergence. Thus, the matrix will have n rows and 4 columns. The quotient of the division of K[1,3] \div K[2,3]=3 is written as K[2,4], that of K[2,3] \div K[3,3]=1 as K[3,4], so on till convergence. Thus, the cells K[4,1] and K[4,n] will always be empty (NA in the R language).

Then we fill in K[n,2]=1 and K[n-1,2]=0. There after we compute the remaining elements of this column working upwards from K[n-2,2] with the formula:

K[j,2]=K[j+1,2]\cdot K[j+1,4]+K[j+2,2]

We then fill in K[n,1]=0 and K[n-1,1]=1 and complete the column starting K[n-2,1] upwards with the formula:

K[j,1]=K[j+1,1]\cdot K[j+1,4]+K[j+2,1]

With that we have our kuṭṭaka matrix K and all the needfull stuff to solve the said indeterminate equation:
1) The greatest common divisor \textrm{GCD}(a,b)=K[n-1,3]. This is also the smallest positive c for which our indeterminate equation has integer solutions.
2) The least common multiple \textrm{LCM}(a,b)=K[1,1]\cdot K[2,1]\cdot K[n-1,3]
3) The integer lattice points through which the line passes are obtained from (K[2,2],K[1,2]) by assigning the appropriate signs. Thus, for the above equation we have the solution 95\times(-1)-25\times (-4) = 5. Thus, 95x-25y=5 will pass through the integer lattice at the point (-1,-4)
4) If we enforce the need for positive solutions then we can use (K[2,1]-K[2,2], K[1,1]-K[1,2]) to obtain the minimal integer solution: 95 \times 4 -25 \times 15 =5. Thus, 95x-25y=5 will pass through the integer lattice at the point (4,15) in the first quadrant.
5) We can write the following relationship, which helps us to more generally get the lattice points through which the line ax-by=c passes even if the values of a and b are interchanged or for c other than the minimal c:

b(K[1,1]\cdot p+K[1,2] \cdot q)-a(K[2,1]\cdot p +K[2,2]\cdot q)=K[n-1,3]\cdot q

Thus, if we set p=-1, q=1, we get (-4,-15) as further lattice points through which the line 95x-25y=5 passes.

Now we can tackle the original problem: Since it says that 7 divides the number r perfectly it can be written as r=7y where y will the y-coordinate of the lattice point. The numbers 2, 3, 4, 5, 6 leave a remainder of 1. Of them 4 is divisible by 2, and 6 by both 2 and 3. So all we need to consider are the numbers 4, 5, 6. Using the above kuṭṭaka or any other means we can show that \textrm{LCM}(4,5)=20 and \textrm{LCM}(20,6)=60. Thus, we can write 7y=60x+1, where x will the x coordinate of the integer lattice. Using kuṭṭaka on the equation 7y-60x=1 we get the matrix:

K=\begin{bmatrix} 60 & 17 & 60 & NA\\ 7 & 2 & 7 & 8\\ 4 & 1 & 4 & 1\\ 3 & 1 & 3 & 1\\ 1 & 0 & 1 & 3\\ 0 & 1 & 0 & NA\\ \end{bmatrix}

From this we can compose (60-17) \times 7 - (7-2) \times 60 = 1. Thus, our number is r= 43 \times 7 = 301, which is divisible by 7 but leaves a remainder of 1 for all integers from 2:6. More generally, if we say that r \mod 2:6 \equiv 1 then we can use K to compose the negative solutions r=-17 \times 7=-119 or r=-77 \times 7 =-539. Such triplets of solutions correspond to symmetric lattice points along the line.

In the final part of this note we shall consider the following operation: Take a number n and perform the kuṭṭaka operation with it (i.e. a=n) and all integers lesser than or equal to it (i.e. b=1:n). Then we count the number of iterations it takes with each of these integers to reach convergence. From above it is clear that the minimum number of iterations for convergence will always be 3. We term the result the kuṭṭaka spectrum of a number and plot this spectrum for the numbers 120, 123, 127 and 128.

kuTTaka_spectrumFigure 1

The kuṭṭaka spectrum displays several notable features:
1) It is pseudo-symmetric about the mid-point, i.e. either side of a/2 is an approximate mirror image of the other side but they differ in “height” by one iteration.

2) The number of times the kuṭṭaka spectrum hits a minimum (i.e. converges in 3 iterations) is equal to the number of divisors of a, D(n). Thus, for a highly composite number, as defined by Ramanujan, we get the record number of minima in the kuṭṭaka spectrum for any number less than it. Thus, in our example the highly composite number a=120 has 16 minima with the first six integers 1:6 giving a run of 6 successive minima. A minimally composite number like a=123=3 \times 41 in our figure we get 4 minima, namely 1 and the number itself and its two prime factors. The prime number in our figure, a=127, as expected has only 2 minima.

3) The more composite a number the lower its mean value of iterations (red line in Figure 1) than other integers in its immediate neighborhood. Thus, the highly composite number 120 has the lowest mean value in our set. In contrast, the primes have higher mean values than the integers in their immediate neighborhood. This is can be seen with a=127 in Figure 1.

4) A curious feature of the spectrum are the maxima, i.e. the value of b for which the maximum number of iterations are required for pulverizing a to convergence. For example the spectrum of a=128 shows 2 maxima: b=79 pulverizes it via the pathway: 128, 79, 49, 30, 19, 11, 8, 3, 2, 1, 0. The other one b=81 via 128, 81, 47, 34, 13, 8, 5, 3, 2, 1, 0. One immediately notices that the convergence in each of these two cases enters the Golden ratio convergent sequence. This feature can be investigated further by examining the distribution of the values of a/b for those b which result in maxima in the kuṭṭaka spectrum for a given a. In order to have have clear discrimination of these fractional values of a/b corresponding to the spectral maxima we chose a set of relatively large a, namely all integers from 500 to 1000. We then determined the kuṭṭaka spectrum for each of those numbers and extracted the maxima for each a and plotted a distribution of the a/b values (Figure 2).

kuTTaka_maximaFigure 2.

First, the maxima always occur in second half of the spectrum (Figure 2), i.e. b>\tfrac{a}{2}. This makes sense because smaller b would reach close to a in the first division itself and could pulverize it to a relative small number. However, b>\tfrac{a}{2} would fit only once in a and could leave a relatively large remainder that could need more steps for pulverizing. Second, strikingly, the dominant peak in this distribution is the Golden ratio \phi (Figure 2), suggesting the maxima tend to occur where \tfrac{a}{b} \approx \phi. Indeed in our above example \tfrac{128}{79}=1.620253. This can be intuitively understood as the b which generates a maximum may be seen as a Golden cut of a: if b>\tfrac{a}{2} is too big then the remainder generated will be small and might be pulverized quickly. If b>\tfrac{a}{2} is too small then it will leave a big remainder relative to b which might be quickly pulverized in the next step. Thus, the \phi could give you the cut that is just right. The next dominant peak is at 3-\phi \approx 1.381966. This is similar to \phi in its operation. These two are marked by a red dashed line in Figure 2.

There are further peaks in the distribution corresponding to other fractions on either side of \phi following a certain pattern of declining heights. Further they show the same symmetry as \phi and 3-\phi, with each peak m having a counterpart 3-m. We have thus far not been able to determine a more
general expression describing all these peaks or prove why they should be peaks but we were able to account for a subset of them as corresponding to other quadratic irrational numbers (marked by grey dashed lines in Figure 2). These include:

\sqrt{35/11} \approx 1.783765, 3-\sqrt{35/11} \approx 1.216235
\sqrt{3} \approx 1.732051, 3-\sqrt{3} \approx 1.267949
\sqrt{24/9} \approx 1.632993, 3-\sqrt{24/9} \approx 1.367007
\sqrt{2} \approx 1.414214, 3-\sqrt{2} \approx 1.585786

Of these the pair \sqrt{2}, 3-\sqrt{2}, especially the former is not the best fit to the peak but given the breadth of that peak it is possible that more than one attractor fraction is merged in that peak. It would be a good mathematical quest to discover the general expression for the peaks, their dominance and prove why they tend to be peaks. There might be a subtle fractal structure to them that might become apparent at large values of a.

This entry was posted in Heathen thought, Scientific ramblings and tagged , , , , , . Bookmark the permalink.