International Conference on the History of Indian Mathematics 2026

The Patākā
in the Gaṇitakaumudī

Prasad Jawalgekar · Bhumika Mittal · K. Ramasubramanian · Aalok Thakkar

Nārāyaṇa Paṇḍita and the Gaṇitakaumudī
1356
composed, CE
≈930
verses, in fourteen chapters
≈140
verses in Chapter 13 alone

The full text surfaced only in the twentieth century, when Padmākara Dvivedī found a complete manuscript in his father Sudhākara's collection and printed it in two volumes, 1936 and 1942.

Aṅkapāśa

अथ गणकानन्दकरं सङ्क्षेपादङ्कपाशकं वक्ष्ये ।
निपतन्ति यत्र मत्सरवन्तो दुष्टाः कुगणका ये ॥

atha gaṇakānandakaraṃ saṅkṣepādaṅkapāśakaṃ vakṣye | nipatanti yatra matsaravanto duṣṭāḥ kugaṇakā ye ||

I now introduce aṅkapāśa, which delights mathematicians, and where the jealous, wicked, and incompetent (kugaṇaka) suffer a fall. A pun, śleṣa: the subject of combinatorics, and a net of numbers that traps bad mathematicians.

He then lists where it applies, across six different fields:

dramatics bharata prosody chandaḥśāstra medicine vaidya garland-making mālyakriyā mathematics gaṇita architecture śilpa
Recitation courtesy of Vāgdhenu
The Patākā antima m = 3 · sthāna n = 3
1
2
4
10
3
5
7
11
13
19
6
8
12
14
16
20
22
9
15
17
21
23
25
18
24
26
27

How do we construct a patākā for any give antima and sthāna?

The Patākā antima m = 4 · sthāna n = 3
1
2
5
17
3
6
9
18
21
33
4
7
10
13
19
22
25
34
37
49
8
11
14
20
23
26
29
35
38
41
50
53
12
15
24
27
30
36
39
42
45
51
54
57
16
28
31
40
43
46
52
55
58
61
32
44
47
56
59
62
48
60
63
64
Two Questions
How is it built?

A construction for any antima m and sthāna n, not just m = n = 3.

What does it mean?

What the entries are, and why the flag takes this shape.

The Guṇottara Sequence

आदौ रूपं विलिखेत् अन्तिमगुणितं पुरः पुनस्तद्वत् ।
स्थानाधिकं तु यावत् पङ्क्तिर्गुणकोत्तराख्येयम् ॥

ādau rūpaṃ vilikhet antimaguṇitaṃ puraḥ punastadvat | sthānādhikaṃ tu yāvat paṅktirguṇakottarākhyeyam |

Powers of m:  G(m, n) = 1, m, m2, …, mn.

For m = 3:  1, 3, 9, 27, the corners that close each stage.

1
3
9
27
The Ābhyāsikī Sequence

स्थानाहतोऽन्तिमाङ्कः सैकः स्थानोनितश्च तच्छेषम् ।
आभ्यासिक्यां पङ्क्तौ प्रजायते स्थानमानमिह ॥

sthānāhato'ntimāṅkaḥ saikaḥ sthānonitaśca taccheṣam | ābhyāsikyāṃ paṅktau prajāyate sthānamānam iha |

Multiples j·mr, in increasing order: the first-row values.

1 2  3×3 6  9×3 18  27

For m = n = 3:  A = 1, 2, 3, 6, 9, 18, 27, the smallest number in each column.

What is the ābhyāsikī for m = 4, n = 3?

1 2  3  4×4 8  12  16×4 32  48  64

A = 1, 2, 3, 4, 8, 12, 16, 32, 48, 64.

The Nārācikā Sequence

अन्तिममितवैश्लेषस्थानाङ्कमिताश्च ताः पृथक् स्थाप्याः ।
तासां घातः सूचीपङ्क्तिर्नाराचिका वा स्यात् ॥

antimamitavaiśleṣasthānāṅkamitāśca tāḥ pṛthak sthāpyāḥ | tāsāṃ ghātaḥ sūcīpaṅktir nārācikā vā syāt |

Coefficients of (1 + x + ⋯ + xm−1)n.

For m = n = 3:  (1 + x + x²)³ = 1 + 3x + 6x² + 7x³ + 6x⁴ + 3x⁵ + x⁶,  so N = 1, 3, 6, 7, 6, 3, 1.

1
2
3
6
9
18
27
Subtract One, Write in Base Three

the numbers 1 to 27

each number, less one, in three base-three digits · 1 becomes 000, 27 becomes 222

add the three digits · the digit sum runs from 0 to 6

group by digit sum, keeping each group in increasing order

the patākā assembles itself · column heights 1, 3, 6, 7, 6, 3, 1

The patākā is an enumeration of [m]n.

All mn ways to fill n places with m symbols, each set in the column of its digit sum.

The same structure surfaces in the algorithm of the verses.

The Patākā Verses

नाराचपङ्क्त्यङ्कमिताः कोष्ठानामूर्ध्वपङ्क्तयः । तिर्यग्गामी च सर्वासां स्वस्वखण्डावसानमा ॥
पङ्क्तौ तदाद्यकोष्ठे यः पल्लवोऽथाङ्कयोजनाः । तिर्यक्स्थितायामाद्यायां पङ्क्तिमाभ्यासिकीं लिखेत् ॥

तदन्तिमाङ्कः क्षेपाख्यः पुरःस्थः साध्यनामकः । क्षेपं पुरातनैरङ्कैः क्रमात् संयोजयेत् पृथक् ॥
तानधस्तिर्यग्गायां च कोष्ठपङ्क्त्यां विनिक्षिपेत् । साध्याङ्कस्य पताका स्यात् साध्यं क्षेपं प्रकल्पयेत् ॥

साध्यं पुरःस्थितं कृत्वा क्षेपं प्राग्वत् पुरातनैः । अङ्कैराद्यद्वितीयादिकोष्ठपङ्क्तिगतैर्युतम् ॥
तिर्यङ्निरङ्ककोष्ठेषु साङ्काधःस्थेषु विन्यसेत् । येनाङ्केन युतः क्षेपः साध्याङ्कादधिको यदा ॥
तदा मुक्त्वा तमङ्कं तु योजयेदितरांस्ततः ॥

Reading the Verses Again

पुरातनाङ्कः

purātanāṅka

the old number

A number already placed in the flag. Every new entry is built from one.

क्षेपः

kṣepa

the increment, j·3r

The current first-row term. Adding it raises one base-three digit by j, so the sum lands exactly j columns to the right.

साध्यः

sādhya

the bound

The next first-row term. Keep only sums below it: precisely the condition that no carry occurs.

The Patākā Algorithm

Given antima m and sthāna n: write the ābhyāsikī along the first row, then fill the grid along the diagonals.

keep track of only three numbers

kṣepa K3
sādhya S6
purātanāṅka p1, 2

first row laid · K = 3, S = 6

साध्याङ्कस्य पताका स्यात् ।

sādhyāṅkasya patākā syāt |

The patākā is [the same] as the sādhya number.

1
2
4
10
3
5
7
11
13
19
6
8
12
14
16
20
22
9
15
17
21
23
25
18
24
26
27
QR code to the interactive patākā on this site
the interactive patākā, on this site
One Patākā Inside the Next

Each closed stage is a complete smaller patākā. Raising n by one wraps the whole flag inside a larger one.

  • (3, 1)3 cells
  • (3, 2)9 cells
  • (3, 3)27 cells
The Algorithm, Formally
Patākā(m, n)   ▷ antima m, sthāna n
  A ← ābhyāsikī(m, n)   ▷ first-row values j·m^r
  write A along the first row
  K ← A[2];  S ← A[3]   ▷ kṣepa (increment), sādhya (bound)
  repeat
    for each placed entry p, in order:
      if p + K < S:
        place p + K in the next diagonal cell
          ▷ column of p, shifted right by offset(K)
    K ← S;  S ← next term of A
  until K = m^n
  return the grid

offset(K) = j   where K = j·m^r

Column k lists the indices of [m]n whose base-m digits sum to mn − k, in increasing order.  The whole grid is built in Θ(n · mn) time, optimal for listing all mn indices.

Thank you

open for questions