Patterns, Recursions and Iterations
In Saṃskṛta Poetry, Music and Percussion
As a continuation to the popular workshop held on this subject, this course offers a deeper exploration into the birth of binary mathematics and how various recursive and iterative algorithms were discussed in the Indian subcontinent through the subject of poetry and extended into music and percussion instruments.
We take Piṅgala’s Chandaḥśāstra, Śārṅgadeva’s Saṅgītaratnākara and similar texts to understand how Indians developed the branch of Combinatorics and Computational Thinking centuries and millennia ahead of the Western world.
Highlights:
-
Binary and recursion in Piṅgala’s Chandaḥśāstra: list, count and locate any metre
-
Meru Prastāra (Pascal’s triangle), Mātrā Meru and Khaṇḍa Meru
-
Piṅgala’s algorithms applied to tāla and tāna in percussion and Indian classical music
-
The history and development of zero, from idea to number
-
Poetry as a pathway into mathematical patterns and algorithmic thinking
Overview
Are poets and musicians applied mathematicians? Is there math in music and poetry? What makes a particular rhythm rhythmic?
These are questions that often come up during discussions in classical music and poetry. Some say that mathematics of patterns, beats and fractions come naturally to musicians while some say that a musician doesn’t care much about mathematics and it is intuition that helps them build melodious music. However, in the history of Classical Music and Saṃskṛta Prosody, we see stalwarts like Piṅgala, Hemacandra, Śārṅgadeva, who wrote treatises on music with a strong emphasis on mathematics.
In today's times, where topics like the Fibonacci sequence are largely restrained to certain knowledge domains and may seem disconnected from real life - through poetic metres and musical rhythms, learners encounter mathematical ideas in forms they can hear, practise and create. In this course, we will look at the birth of some ideas like iterations and recursions in Saṃskṛta poetry, music and percussion instruments.
We will see how binary mathematics, permutations and combinations developed in the Indian subcontinent 2300 years ago through some unassuming areas such as poetry and music. We will also see the history and development of zero as an idea to a number.
Intent
Mathematics often evokes polarised responses, with many learners developing an aversion to it because of the way it is presented. Chandas (prosody) offers an engaging way to explore permutations, combinations and binary mathematics through an art form, drawing a wider audience into mathematical inquiry.
Concepts such as iteration, recursion and optimisation are today closely associated with computer science, and highly intensive mathematical concepts can feel abstract to grasp and apply. Viewed through poetry, music and rhythm, however, these ideas acquire a more tangible and engaging form for students, educators and seekers alike.
This course explores how such mathematical ideas emerge in Saṃskṛta poetry and extend into music and percussion, revealing the connections between artistic expression and algorithmic thinking.
Structure
A precursor to this course was offered in August 2026 as a two-day workshop. In this course, we will repeat the content of the earlier workshop in the first two sessions.
This course is an independent course in itself for someone who wants to see the beauty and intersection of Saṃskṛta language, mathematics and computer science. The course will discuss about the development of combinatorial ideas over a period of 1500 years in India. There is no pre-requisite for this course except basic knowledge of the Devanāgarī script.
Contents
Module 1
-
Session 1 (13 Nov): How do you list every possible metre? - Varṇa Vṛtta, the 8 Gaṇas, Prastāra
An introduction to syllabic metres, ganas (groups of syllables) and the eight three-syllable gaṇas (ya, ma, ta, ra, ja, bha, na, sa) that from the building blocks of a syllabic metre. Recursive algorithm for a sorted list of every possible pattern (prastāra).
-
Session 2 (14 Nov): Binary numbers 2,000 years ago, and finding any metre by its row number - Binary Mathematics, Saṃkhyā, Naṣṭa & Uddiṣṭa, Meru Prastāra
Revisiting Prastāra using iterative algorithms. Applying binary mathematics to list an array. Optimal algorithm for 2n. Discussions about history and evolution of zero. Finding the row of a given array/prastāra, and the string/pattern at a given row (naṣṭa and uddiṣṭa). Practice problems, and Meru Prastāra (the so-called Pascal’s triangle).
-
Session 3 (15 Nov): When syllables have weights - Mātrā Vṛtta, Prastāra, Saṃkhyā
With laghu and guru given different weights, how do we sort an array of syllables and count the possibilities? We study mātrā vṛttas, used in Prākṛta metres and vernacular languages. Fibonacci sequence in poetry.
-
Session 4 (20 Nov): Which mātrā metre is number 37? - Naṣṭa, Uddiṣṭa, Mātrā Meru
Finding the row of a mātrā metre and the string/pattern at a given row of a particular mātrā metre, and building the Mātrā Meru. A deeper look at the computational thinking inside Chandas.
-
Session 5 (21 Nov): The mathematics of beats. Tāla Prastāra, Saṃkhyā
Recursive and iterative algorithms for listing beat patterns in percussion, and counting how many combinations are possible using druta, laghu, guru and pluta (1 beat, 2 beats, 4 beats and 6 beats).
-
Session 6 (22 Nov): Finding a rhythm by its row number - Naṣṭa, Uddiṣṭa in Tāla Prastāra
Finding the row of a pattern in a druta prastāra, and the pattern at a given row.
-
Session 7 (27 Nov): Practice lab and doubt-clearing
Problem-solving, revision and open questions on Sessions 1–6.
-
Session 8 (28 Nov, 7–9 AM IST, morning session): Combinatorics in classical music - Tāna Prastāra
An introduction to combinatorics in Indian classical music, with sorting and listing algorithms using iteration and recursion.
-
Session 9 (29 Nov): Finding the row of a tāna, and the Khaṇḍa Meru - Naṣṭa & Uddiṣṭa in Tāna Prastāra, Khaṇḍa Meru
Finding the row of a tāna and the tāna at a given row, and the Khaṇḍa Meru.
Key Takeaways
Work with binary mathematics, recursion and iteration
Apply them as Piṅgala’s Chandaḥśāstra does, to list, count and locate patterns.
Understand
Pratyayas and 8 Gaṇas as explained in Piṅgala’s Chandas.
Learn the pratyayas and the gaṇas
Understand the procedures for listing (prastāra), finding (naṣṭa, uddiṣṭa) and counting (saṃkhyā) metres, and the eight gaṇas that build them.
Carry Piṅgala’s algorithms into new territory
See how they extend from syllabic metres to mātrā metres, percussion and Indian classical music.
Understand the mathematics behind Chandas
Including Meru Prastāra, Mātrā Meru and Khaṇḍa Meru, and the history and development of zero.
Use poetry as a path to algorithmic thinking
Build a way of thinking that carries into computer science and mathematics.
Who is this course for?
- Classical musicians, dancers and tāla learners: see the mathematical structure behind the rhythms and melodic patterns you already practise.
- Computer science students and professionals: meet iteration, recursion and binary logic in an ancient setting.
- Saṃskṛta and literature students and teachers: understand the mathematical structure of Chandas and metre.
- School students (Grade 8 and up, suggested minimum age 13): a creative way into binary numbers, permutations and combinations. Needs place value, powers and exponents, and basic arithmetic.
- Educators and curriculum designers: ideas and examples for interdisciplinary teaching.
- Homeschooling parents: a culturally rooted approach to mathematics.
- Curious learners: anyone drawn to the link between Saṃskṛta poetry, mathematics and computing.
Know your Instructors
Śrī Aparajith S.
Aparajith serves as an educational consultant of Agastya Gurukulam, guiding its vision of integrating Saṃskṛtam and scientific learning. He teaches Gaṇitam for middle school students in the Gurukulam. With a strong foundation in Mechanical Engineering and a deep passion for Saṃskṛtam and Physics, he brings a unique blend of scholarship and innovation to the institution. He contributes extensively to educational initiatives, like preparing Mathematics textbooks and leading the Gaṇitam teacher-training course. He was also instrumental in designing the co-schooling programs that make classical knowledge accessible to all children. Currently he is pursuing a PhD in Samskrtam.
Śrī Vinay Nair
Vinay Nair is a mathematics educator working in the space of developing higher order thinking skills since over 17 years. He completed his PhD in mathematics education from Chinmaya Vishwa Vidyapeeth and his research was in integrating IKS and Mathematics Education. He co-founded the Raising A Mathematician Foundation in 2014, a not-for-profit organisation working towards identifying and nurturing mathematical talents across Bhārata. In 2018, he founded Vichar Vatika, an organisation working towards building mathematical thinking and love for the subject through puzzles and games. He is passionate about Indian Knowledge Systems (IKS) and has been conducting national-level residential training programs on mathematics in IKS for school students for the past 16 years. So far, he has conducted about 50 residential training programs in mathematics in partnership with premier institutions in Bhārata such as Chennai Mathematical Institute, Azim Premji University, Krea University, etc. He has served on a NCERT committee for a year to identify the causes for maths phobia among the students. He is the recipient of Maths Genius Award 2015, AIR 8 in Teaching Professionals Olympiad 2018 and Indian Achievers’ Award 2023 for Outstanding Professional Achievement.
What Our Draṣṭā Participants Say
Truly enriching and thought provocative. I really enjoyed the interactions and learning about Pingala's varna vritta and would like to know more about chandas. I would have loved if it could have been more like a series extended over a few weeks and delt with much more topics mentioned in the chanda sutra. Saying so, I am extremely greatful to Vinay sir and Brhat for putting together such an informative workshop.
S Haripriya
Music, Math and Sanskrit Enthusiast
Heartfelt gratitude to the organising team and Vinay Sir for the insightful and interactive sessions. It felt surreal knowing about our heritage , music , poetry and how Mathematics weaves all these together.
Vaishali Lakhani
Thanks, Vinayji, for the session. It was very informative and educative. Your session certainly kindled curiosity among all the seekers and encouraged us not merely to learn, but to think, question and explore. To me, that is the hallmark of an excellent teacher and mentor. I joined this course almost as though it were a divinely sent message. A few months ago, I had developed a Python program where I could feed a verse or text in Sanskrit or Kannada, and the program would automatically identify and mark the laghu–guru patterns. My interest is to explore these metrical patterns across different forms of literature and investigate whether particular rhythmic structures evoke bhāva, bhakti, anuśāsana and rasa when a seeker recites, chants or reads a verse.
Vikram Sridhar
Thanks to Vinayji & Brhat for a very fascinating session on छन्दः , गणित: interfaced with कविता श्लोक इत्यादि. While I initially imagined it to be a session difficult to understand, it was thrilling to get the correct answers by following the steps outlined in the सूत्र:. Thank you Brhat for facilitating yet another superb learning experience. I would also like to congratulate both Sri Vinay ji and Brhat once again for having a number of young students as participants in this workshop. It was simply lovely to listen to the children answering questions & actively participating in the group. Best wishes to them - this is the true next generation.
Mrinalini Menon
Associate Professor, Department of Biotechnology, Sir MVIT Bangalore
Patterns, Recursions and Iterations
Our Draṣṭā online courses are designed to help you in your learning journey
Become a part of the community and engage, share, discuss and deepen your learnings
Interact with the course instructor through live sessions
Access to session recordings and materials
Become a member and dive into the Indic universe
Brhat subscription gives access to exclusive member-only content rooted in the Dharmic worldview.
Starts at ₹500 per month.