# Narayana and Fermat's Factorization Method

In some notes of mine I have found a comment according to which the Indian mathematician Narayana Pandit (14th century) found the prime factors of $1161$ by writing it in the form $1161 = 35^2-8^2$. Unfortunately I can't find the source of this piece of information. Any help is appreciated.

• It is clearly a multiple of (a multiple of (a multiple of)) 3. – Aaron Meyerowitz Jun 13 '17 at 12:16
• When was the fact that a positive integers such that the sum of its decimal digits is divisible by 9 is itself divisible by 9 first recorded? As @AaronMeyerowitz implicitly suggests, this applies here – Geoff Robinson Jun 13 '17 at 13:23
• I know that the factorization itself is no big deal. Divisibility rules for 3 and 9 can probably be found in Greek sources (and certainly the Babylonians knew such rules, but in the sexagesimal system divisibility by 3 is a simple observation), and I am aware of various references to divisibility by 3 and 9 in the Arabic and Indian literature. What is of interest here is the method of factorization. – Franz Lemmermeyer Jun 13 '17 at 13:49
• Sure. I was just wondering why Pandit would use a complicated factorization method when he might have seen factors very easily – Geoff Robinson Jun 13 '17 at 14:31
• There is a copy of part II of his book "Ganitha Koumudi" in archive.org: archive.org/details/in.ernet.dli.2015.368318 It is in sanskrit and 400 pages long. Maybe some literate can read it and find if he mentions his method in there. – EFinat-S Jun 13 '17 at 16:14

Vedveer Arya seems to be the person to ask about the connection and original sources: He wrote that Fermat's factorisation method was predated by Narayana Pandit.

1) https://www.eswaraindia.org/html/lecture-series13.html This seems to be based on a lecture, in the table entry 19 is on this. An email address of the author is included.

(after some comments on Pell's equations he writes: "This method of Nārāyana Pandit is amazingly accurate and equivalent to all other methods. In the enclosed illustration, he explicitly applied a factorization method by representing a non-square integer as the difference of two squares. This method is now known as Fermat's factorization method whereas Nārāyana Pandit applied it much earlier than Fermat. Hence, this method must be named as Nārāyana Pandit's factorization method." (Some formulae follow where I do not see a connection to the factorization method).

another document, at the very end is the same text as in 2)

4) He has written a book of 380 pages, Indian contributions to mathematics & astronomy : from vedic period to 17th century. http://www.dkagencies.com/doc/from/1123/to/1123/bkId/DKB3317162763217421699131230371/details.html

• Thanks for the reference. I now discovered that both the factorization method and the example $N = 1161$ may be found in Narayana's Ganita Kaumudi (Parmanand Singh, Bulletin of indian society of history of mathematics, Vol. 22,) on p. 71-73. Apparently the method first appears in an astronomical treatise (Siddhanta Sekhara) of Sripati from the 11th century, of which I only found the Sanskrit original on the web. – Franz Lemmermeyer Jun 15 '17 at 10:01
• Sripati's rule may be found here: sandhi.hss.iitb.ac.in/Sandhi/… – Franz Lemmermeyer Jun 15 '17 at 10:19
• Singh's collection of articles are also available here: sandhi.hss.iitb.ac.in/index.php/articles-new/… – Franz Lemmermeyer Jun 15 '17 at 11:35

You might try the article 'Narayana Pandit' in the book Mathematical Achievements of Pre-Modern Indian Mathematicians
http://www.sciencedirect.com/science/article/pii/B9780123979131000120

I don't have access to the text but the abstract looks plausible. The book's introduction includes discussion of mathematical precursors of Fermat in India:

Bhaskara II solved in integers the equation $$Nx^2+1=y^2$$ by introducing his famous “Chakravala” (cyclic) method. As an illustration of his elegant and simple method, he gave two examples of solving in integers, the equations $$67x^2+1=y^2$$ and $$61x^2+1=y^2$$. The latter example is of great historical interest. This example was proposed by the famous French mathematician Pierre De Fermat (ad 1601–1665) to Frenicle in a letter of February AD 1657.

In AD 1350, Narayana Pandita, a commentator of Bhaskara II’s “Bijaganita,” solved in integers two more equations $$103x^2+1=y^2$$ and $$97x^2+1=y^2$$ in his work “Bijaganita,” using the “Chakravala” method of Bhaskara II. To further demonstrate the elegancy, the beauty, and the simplicity of the “chakravala” method, the present author has included integral solutions of five more new equations: $$179x^2+1=y^2$$, $$131x^2+1=y^2$$, $$231x^2+1=y^2$$, $$31x^2+1=y^2$$, and $$71x^2+1=y^2$$

• Nice book, but I couldn't find any reference to a factorization method there. – Franz Lemmermeyer Jun 13 '17 at 22:58

Unfortunately, sources on the history of Indian mathematics are somewhat hard to find on the internet (and even in libraries). Fortunately, this particular question can be answered.

Three scholars of the history of Indian mathematics taught a course called “Mathematics in India - From Vedic Period to Modern Times”, which is available online: see course outline, syllabus, lecture notes, actual course, YouTube playlist. This particular topic (Nārāyaṇa Paṇḍita's treatment of factorization) is covered in Lecture 27 by M. D. Srinivas, starting at slide 12 or from 15:25 to 20:10 in the video.

Apparently this is the first (known) book in Indian mathematics that discusses factorization (as late as c. 1356), but the treatment here is already nontrivial and contains what is known as Fermat's method (17th century). After stating the usual method of checking whether the successive acchedyas $$2$$, $$3$$, $$5$$, $$7$$ etc divide the number (literally, “acchedhya” means “indivisible” or “irreducible”), Nārāyaṇa says: given a non-square number $$N$$,

• writing $$N = a^2 + r$$, if it so happens that $$2a + 1 - r$$ is a square (say $$b^2$$), then our work is done: $$N = (a + 1 + b)(a + 1 - b)$$. [apada-pradasya rāśeḥ padam āsannaṃ dvi-saṅguṇaṃ saikam / mūlāvaśeṣa-hīnaṃ vargaś cet kṣepakaś ca kriti-siddhau //]

• Else, if it ($$2a + 1 - r$$) is not a square, add $$(2a + 3)$$ and so on, and keep doing this [numbers increasing in arithmetic sequence, i.e. successive odd numbers] until you get a square. That is, if $$(2a + 1) + (2a + 3) + \dots + (2a + 2k - 1) - r$$ is a square (say $$b^2$$), then $$N = (a + k + b)(a + k - b)$$. [vargo na bhavet pūrvāsannapadaṃ dvi-guṇitaṃ tri-saṃyuktam / adyād uttara-vṛddhyā tāvad yavad bhaved vargaḥ //]

After having stated this rule, he works out two examples: $$N = 1161$$ and $$N = 1001$$ — of course both are easy to factorize directly (using the straightforward method he mentioned earlier), but I imagine he chose these examples because they illustrate the two cases: in the case of $$1161$$, already $$2a + 1 - r$$ is a square, and in the case of $$1001$$, we have to add as many as $$14$$ terms before we get a square.

More references:

• The (Sanskrit) text of Nārāyaṇa's work (Gaṇita-kaumudī, c. 1356) was first edited and printed by Padmakar Dvivedi, son of Sudhakar Dvivedi in two volumes: 1936 (Volume 1) and 1942 (Volume 2).

• It took me a while to locate it, but this particular section on factorization (part of vyavahāra (Chapter) 11) is on page 246.
• An English translation of the work, with notes, was published by Paramanand Singh in successive issues of the journal Gaṇita Bhāratī: 20 (1998), pp. 25–82; 21 (1999), pp. 10–73; 22 (2000), pp. 19–85; 23 (2001), pp. 18–82; 24 (2002), pp. 34–98.

• Some (more easily available) (brief) references to Nārāyaṇa's Gaṇita-kaumudī (focusing more on combinatorics) can be found in The Art of Computer Programming by D. E. Knuth (Volume 4A, section 7.2.1.7, pp. 499–500, earlier published as Fascicle 4B, draft version online), in the book Combinatorics: Ancient and Modern (OUP 2003), etc.

• (Posted this because the accepted answer has some somewhat irrelevant references pointing to random people, though I see now in the comments on the accepted answer that the OP who asked the question seems to have found the correct references eventually...) – shreevatsa Sep 24 '18 at 1:53