Naṣṭa: From a Row Number Back to the Pattern
Chapter Twenty-Three
Syllabus topic Module 1, "Naṣṭa and Uddiṣṭa (index retrieval mechanisms)"
Pages 73 to 76 of 378
In one line
Naṣṭa takes a row number and gives you the pattern in that row, without writing any of the rows before it.
In the wording you can write in an examination: naṣṭa, literally the lost, is the pratyaya that recovers a metrical pattern from its serial number in the prastāra. Piṅgala's rule halves the number: where the halving is exact a laghu is written, and where the number is odd one is added before halving and a guru is written. The syllables are written from the left, one per halving, until the metre's syllable count is reached.
The problem, and why it is called "the lost"
A student remembers that a verse is the forty-first form of the six-syllable metre but has forgotten the pattern. The pattern is lost and the number survives. Naṣṭa restores it.
The alternative is to build the table and count down to row forty-one. That is 41 rows of work, and for a jagatī it can be 4096. Naṣṭa is six steps, one per syllable.
The provisions
8.24, lardhe. On halving, an L. Halāyudha's gloss, working his own example: if one wishes to know what the sixth of the gāyatrī same-metre forms is, then halve that number six; when it is halved, a single laghu is obtained, to be placed on the ground, that is, in the first position.
8.25, saike g. With one added, a G. His gloss: in the case of an odd number, add one, then halve; there a single ga is obtained, to be placed after the syllable previously obtained. And then: this rule of saike ga is to be applied again and again, until the syllables are complete, six in number.
Both numbers agree across this book's witnesses.
The rule as steps
- Write down the row number.
- If it is even, halve it and write L.
- If it is odd, add one, halve the result, and write G.
- Write each syllable to the right of the last, so the first syllable obtained is the leftmost.
- Repeat until you have as many syllables as the metre has. Stop then, whatever number you are holding.
Step five matters. The number will usually reach one and stay there, and those steps still produce syllables. You stop by counting syllables, not by reaching zero.
Worked by hand: row 6 of the gāyatrī
This is Halāyudha's own example.
| Step | Number | Even or odd | Operation | Syllable |
|---|---|---|---|---|
| 1 | 6 | even | halve to 3 | L |
| 2 | 3 | odd | add one, halve to 2 | G |
| 3 | 2 | even | halve to 1 | L |
| 4 | 1 | odd | add one, halve to 1 | G |
| 5 | 1 | odd | add one, halve to 1 | G |
| 6 | 1 | odd | add one, halve to 1 | G |
Naṣṭa: From a Row Number Back to the Pattern
Reading the syllable column downward gives L G L G G G, and that is row six.
Check it against the other rule: [Uddiṣṭa: From a Pattern to Its Row Number] takes L G L G G G and returns six. The two rules agree, and they must, because they are inverses.
Worked by hand: row 41 of the gāyatrī
| Step | Number | Even or odd | Operation | Syllable |
|---|---|---|---|---|
| 1 | 41 | odd | add one, halve to 21 | G |
| 2 | 21 | odd | add one, halve to 11 | G |
| 3 | 11 | odd | add one, halve to 6 | G |
| 4 | 6 | even | halve to 3 | L |
| 5 | 3 | odd | add one, halve to 2 | G |
| 6 | 2 | even | halve to 1 | L |
G G G L G L, which is the pattern [Binary Number Systems, and Exactly Where Piṅgala's Order Agrees] reached by arithmetic and which uddiṣṭa returns forty-one for.
Why the rule is right
In the binary reading, the row number minus one is the pattern's value with laghu as one and the leftmost syllable in the units place. So the first syllable is laghu exactly when the units bit of the row number minus one is one, that is, exactly when the row number minus one is odd, that is, exactly when the row number is even.
That is step two. And halving the even row number r gives r over two, whose parity decides the next syllable in the same way.
For the odd case, r minus one is even, so the bit is zero and the syllable is guru; and the next number needed is r minus one over two plus one, which is r plus one over two. That is step three, with the plus one before the halving doing exactly that arithmetic.
So: "add one before halving at an odd number" is the correction that keeps the count on a one-based scale. That single detail is what makes the rule work on row numbers rather than on values, and it is the detail a student who reinvents the rule always gets wrong.
The rule, run, with both directions checked
def nasta(n, r):
"""8.24 lardhe and 8.25 saike g.
Halve the row number; if it was even write a laghu, and if it was odd add
one before halving and write a guru. Do this n times, writing from the left.
"""
out = []
x = r
for _ in range(n):
if x % 2 == 0:
out.append("L")
x //= 2
else:
out.append("G")
x = (x + 1) // 2
return "".join(out)
def uddista(pattern):
y = 1
for ch in reversed(pattern):
y *= 2
if ch == "G":
y -= 1
return y
print("the six syllable metre, Halayudha's own example is row 6")
for r in (1, 6, 41, 64):
p = nasta(6, r)
print(" row %-3d nasta gives %-8s uddista gives it back as %d" % (r, p, uddista(p)))Naṣṭa: From a Row Number Back to the Pattern
the six syllable metre, Halayudha's own example is row 6
row 1 nasta gives GGGGGG uddista gives it back as 1
row 6 nasta gives LGLGGG uddista gives it back as 6
row 41 nasta gives GGGLGL uddista gives it back as 41
row 64 nasta gives LLLLLL uddista gives it back as 64The cost
One halving and at most one addition per syllable, so the work is proportional to n and independent of how large the row number is. Finding row 4000 of a twelve-syllable metre costs the same twelve steps as finding row 1.
What it does NOT mean
It does not check the row exists. Ask for row 100 of a three-syllable metre and the rule returns a pattern. There are only eight rows. Nothing in the text validates the input and a program must.
It does not stop when the number reaches one. It stops when the syllable count is reached. A reader who stops early produces a short pattern, and this is the commonest mistake in working the rule by hand.
It does not depend on the table existing. That is the point of it. The pattern is computed, not looked up, and the table never has to be written at all.
Quick revision
- Naṣṭa: from a row number to the pattern in that row.
- 8.24 lardhe: halve, and write L. 8.25 saike g: if odd, add one, halve, and write G.
- Write syllables left to right, one per step, and stop when the syllable count is reached, not when the number reaches one.
- Halāyudha's own example: row 6 of the gāyatrī is L G L G G G.
- Row 41 of the gāyatrī is G G G L G L.
- Cost proportional to the number of syllables, independent of the row number.
- The "add one before halving" is the correction for rows being counted from one.
Test yourself
1. Find row 11 of the four-syllable metre by the rule.
11 is odd: add one, halve to 6, write G. 6 is even: halve to 3, write L. 3 is odd: add one, halve to 2, write G. 2 is even: halve to 1, write L. The pattern is G L G L.
2. Why is one added before halving when the number is odd?
Because rows are counted from one and values from zero. For an odd row number r, the value r minus one is even, so the syllable is guru, and the next number required is r minus one over two plus one, which equals r plus one over two.
Naṣṭa: From a Row Number Back to the Pattern
3. When does the rule stop, and what happens if a student stops too early?
It stops when as many syllables have been written as the metre has. Stopping when the number reaches one produces a pattern that is too short, which is the commonest error in working it by hand.
4. How much work does naṣṭa do for row 4000 of a twelve-syllable metre, and how much does generating the table do?
Naṣṭa does twelve halvings. Generating the table and counting to row 4000 does about 4000 rows of twelve symbols, roughly 48,000 symbol operations.
The rest of this subject
These notes are cut from the University's printed syllabus. Open the syllabus itself for the same subject.