RSSAmplifier

Blog

Blog

Recent content on Blog

/RSS feed ↗39 posts

Latest posts

“Right Ho, Jeeves” after Saki

Saki ( 1 , 2 , 3 )—pen name of Hecto Hugh Munro (1870–1916)—was a writer, known for his short stories that are often biting satires sometimes veering to the macabre. P. G. Wodehouse (1881–1975) needs no introduction. Some people find it obvious to mention them together , and list Saki as one of the obvious influences on Wodehouse, e.g. the lede of the Wikipedia article on Saki says, citing…

Tilings with Tetris pieces, and squared Fibonacci numbers

Saw this great observation by Ruud de Rooij (via Robin Houston ): Combinatorics can be a bit weird sometimes: the number of ways to arrange N Tetris pieces into a 2-by-2N rectangle is the Nth Fibonacci number squared. --> First to understand the statement: the picture shows tilings of $2 \times 2N$ rectangles by tetris pieces for $N = 1, 2, 3, 4, 5$, and the number of such tilings (shown) happens…

“tāta” in the Rāmāyaṇa

The Sanskrit word tāta (“father”) is sometimes used affectionately for a younger person. (Similar to “appa” in Kannada etc.) This usage occurs widely in Sanskrit literature, but we can look at the Rāmāyaṇa as an example. Here are all the occurrences of the word tāta in the Rāmāyaṇa, thanks to Dr. Oliver Hellwig’s Digital Corpus of Sanskrit . There are 117 occurrences, some with the meaning…

Mahabharata text and English translations

Just writing down what I know, for future reference. Sanskrit text: manuscript traditions Loosely speaking, the available manuscripts of the Mahābhārata fall into three categories, called recensions: Southern (longest/most elaborate) Northern (≈“Vulgate”) Kaśmīrī (even shorter) The critical edition of BORI (Sukthankar et al) is (again, loosely speaking) the intersection of these. (To be more…

Douglas Adams on the English–American cultural divide over “heroes”

In 2000, Douglas Adams made an interesting observation that I keep returning to. A user on Slashdot named “FascDot Killed My Pr” had asked the following question (where HGttG = Hitchhiker’s Guide to the Galaxy): Comedy….or Tragedy? First, a big thank-you. You’ve made a lasting contribution to “our” culture (or should that be “culture”?) I first read HGttG in my…

Editing a Google Sheet via an app (AppSheet)

TLDR: I hesitate to recommend this to anyone as it’s finicky to set up and may go away, but just in case: Google Sheets has an “Extensions -> AppSheet -> Create an app” that gives an easier interface for editing a sheet from phone (stuff like updating a daily habit tracker or whatever). Last year, I made a “2025 daily tracker” in Google Sheets, where I updated some…

More on shuffles

Yesterday I read a nice post called “doubly dual shuffles” , which 1 pointed out something about the classic algorithm for shuffling an array (i.e. sampling a uniformly random permutation of it). It’s a concise and (his word!) “pearlescent” post and you should read it , but in short, even modulo a simple and uninteresting “mirroring” (where you can move left-to-right or…

Repeated verses in the Rāmāyaṇa and Mahābhārata

The question The following verse occurs twice in the (critical edition of the) Rāmāyaṇa, and four times in the Mahābhārata: सर्वे क्षयान्ता निचयाः पतनान्ताः समुच्छ्रयाः । संयोगा विप्रयोगान्ता मरणान्तं हि जीवितम् ॥ As translated by A. W. Ryder : All gathering ends in dissipation; All heaps, at last, must fall; All friendships melt in separation; And death at last ends all. (More details about its…

Dr. Shankar's next-consonant chitrakavya

Sanskrit has a rich tradition of Chitrakavya (roughly, constrained writing ). Just came to know that Dr. Shankar has composed Sanskrit verses that satisfy a certain constraint (he has named it “anantarākṣarī”): the second half is precisely the first half with each consonant changed to its successor in the alphabet (while vowels are kept untouched). As example, he gives this verse he composed as a…

Tom Lehrer's poem: Dissertation on Education

Tom Lehrer got into Harvard in 1943 at age 15, and it is said that the following poem he wrote (at that age or even earlier) was his admission “essay”. The Loomis Alumni Bulletin issue of autumn 1943 (Loomis was the prep school he went to) said of the poem: The headmaster of Exeter, it is said, carries it in his wallet; it was read aloud to the entering class at Harvard last June; and the…

AI for writing: unexpected utility

I know that some/many people use LLMs (ChatGPT etc) for writing (emails, docs, etc), but I’ve never found it worthwhile myself, for at least two reasons. One, the results always look unnatural and “AI-written” (even with system prompts to make it more casual or concise etc— this post is worth reading though ). My writing style may be nothing to be proud of, but it is mine, and I do want…

Two ways to crack a walnut, per Grothendieck

The mathematician Alexander Grothendieck was “considered by many to be the greatest mathematician of the twentieth century”. Somewhere in his 1000+-page autobiographical work Récoltes et Semailles (“Harvests and Sowings”), he describes two styles in mathematics: Take for example the task of proving a theorem that remains hypothetical (to which, for some, mathematical work seems to be…

Certifying that M_127 is prime

Let $M_p = 2^p - 1$, so that: $$\begin{align} M_2 &= 2^2 - 1 = 4 - 1 = 3 \cr M_3 &= 2^3 - 1 = 8 - 1 = 7 \cr M_7 &= 2^7 - 1 = 128 - 1 = 127 \cr M_{127} &= 2^{127} - 1 \end{align}$$ Is $M_{127}$ prime? This is a large number with 39 digits, specifically it is 170141183460469231731687303715884105727. We can just look up what is known: the Wikipedia article on Mersenne prime links to OEIS A000043 ,…

The sorry state of terminal support for Indic scripts (on macOS)

This will be a quick post to collect some screenshots. I ran diff in the terminal (the macOS default Terminal) on a couple of files containing text in Kannada script, and the output was unreadable. So I tried installing a bunch of other terminals: turns out they’re all even worse. Here’s the test case (just picking the real-world text I was trying to diff; it may contain OCR errors but…

Knuth's program PERFECT-PARTITION-SQUARE

Donald Knuth has a page on his website where he sometimes posts programs he has written. (He says he writes several programs a week, mostly in CWEB and mostly for his own interest, but occasionally posts some of them online.) A couple of days ago, on 2024-06-01, Knuth posted a program, with the description “An amusing recreation”, that solves the following problem:

Checking in with P. G. Wodehouse

P. G. Wodehouse turned 90 in October 1971, was (finally!) awarded a knighthood in January 1975, and died in February 1975. One of the couple of people who managed to interview him shortly before his death was Gerald Clarke, who published the interview in The Paris Review (Winter 1975): P. G. Wodehouse, The Art of Fiction No. 60 — it’s a lovely interview, that I have read often. I posted this…

Notes on a translation choice

My friends Suhas and Anusha have a book of excellent poems on love, translated into English from the Indian literary tradition (Sanskrit/Prakrit) across the centuries, coming out in a couple of days. 1 The book itself is a delight (I’ve read a draft) and I hope literally everyone reads it. I’ll say more about it when I’ve read it again, but in the meantime here just wanted to…

A first-class recitation of the Rāmāyaṇa

The story Like every student of Sanskrit, I had always wanted to read the Vālmīki Rāmāyaṇa, 1 but in the face of several distractions, this had always been a “To-do someday” item: I think I had not even fully read the mere 100 shlokas of the first sarga (Sankshepa Ramayana), despite there being useful resources to do so. Then on 2017-Oct-31, a mailing list post by Suhas Mahesh…

Understanding xii.tex

In December 1998, David Carlisle posted the following to comp.text.tex : \let~\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP A@@FfPARR717273F737271P;ADDFRgniPAWW71FPATTFvePA**FstRsamP AGGFRruoPAqq71.72.F717271PAYY7172F727171PA??Fi*LmPA&&71jfi Fjfi71PAVVFjbigskipRPWGAUU71727374 75,76Fjpar71727375Djifx…

Using pkfix to fix (some) old TeX-generated PDF (PS) files

Here’s an arcane bit of knowledge that may be applicable sometimes: there is a tool called pkfix that can be used to improve the rendering of certain old PostScript files. (Will add more details later.) Example 1 Original: https://cs.uwaterloo.ca/~shallit/Papers/change2.pdf = https://shreevatsa.net/post/2023-pkfix/change2.pdf Fix: wget "https://cs.uwaterloo.ca/~shallit/Papers/change2.ps"…

Mathematical trolling: the Willans prime formula

It has long been of interest to study any regularity in the prime numbers, a question which can be phrased as: “Is there a formula for the $n$th prime number?” While there has been a fair bit of progress and understanding (e.g. the work of Riemann, the prime-number theorem), in 1964 someone named(?) C. P. Willans from the University of Birmingham gave the following “troll” answer, answering the…

Improving on Percy Ludgate's "Irish logarithm"

A quick follow-up to yesterday’s post on the “Irish logarithm” of Percy Ludgate. To recap, the idea is to pick four numbers $f(2)$, $f(3)$, $f(5)$, $f(7)$, and then for all products of nonzero one-digit numbers, define the values of $f$ with $f(ab) = f(a) + f(b)$. For example, this rule defines $f(6)$ as $2f(3)$, and $f(28)$ as $2f(2) + f(7)$. We can write the following Python…

Reverse-engineering the "Irish logarithm"

Source: MJD’s blog post on “The Irish logarithm” (cites Wikipedia: Irish logarithm ). Apparently, Percy Ludgate (1883–1922) was an Irish amateur (was “Boy Copyist” in 1901, and “Commercial Clerk (Corn Merchant)” in 1911, later accountant), who in 1909—unaware of the work of Charles Babbage (1791–1871) and his analytical engine—designed a similar…

Derangements, Dobiński's formula, and their combination

A couple of years ago, someone on a mailing list asked for a proof for their observation that $$B_n = \sum_{k=1}^{n} \frac{k^n}{k!}\cdot\frac{!(n-k)}{(n-k)!}$$ where $B_n$ denotes the Bell numbers (the number of set partitions of $n$ items), and \( !(n-k) \) aka $D_{n-k}$ denotes the number of derangements of $n-k$ items.

Methods for factoring numbers, in the Gaṇita-kaumudī of Nārāyaṇa Paṇḍita

The Gaṇita-kaumudī (गणितकौमुदी) is a work on mathematics written by Nārāyaṇa Paṇḍita in 1356 CE. Also known as the Gaṇita-pāṭī-kaumudī, it contains 14 chapters (see Wikipedia article ), of which chapters 13 (on combinatorics) and 14 (on magic squares) are especially advanced/notable. Recently I took a close look at Chapter 11, which is about factoring numbers. (I had taken a quick look earlier ,…

The harmonic series, the "prime harmonic series", and their difference

Harmonic series Consider the harmonic series 1 + 1 2 + 1 3 + … 1 + \frac12 + \frac13 + \dots 1 + 2 1 ​ + 3 1 ​ + … . Apparently, it was Donald Knuth who in 1968 (vol 1 of TAOCP, section 1.2.7 “Harmonic numbers”) gave the name “harmonic number” and the notation H n H_n H n ​ to the partial sums of this series: H n = 1 + 1 2 + 1 3 + ⋯ + 1 n H_n = 1 + \frac12 + \frac13 + \dots…

Huffman versus top-down coding

(Apologies for the rather incoherent nature of this post — I’m trying, as an experiment to push myself to post more, to “write more quickly”, so a lot of things here are not explained in a way that makes sense and some of it is even nonsensical: forget “polishing” for precision or clarity; I haven’t even written it down reasonably the first time. But whatever…)…

Manually adding an OCR layer to scanned PDF

(Summary: How to add an invisible text layer to a PDF containing scanned images, using an OCR tool—in this case Google Cloud Vision API—that also gives the position of each recognized word.) Background Exploration JSON response TeX side of things Results Background Situation: A printed book has been scanned into images, possibly assembled into a single PDF. As each page is just a picture, no text…

Solving the set cover problem: an example

This blog post is currently a notebook on Colab (click) ; eventually I ought to clean it up and move it here. Posting it here in the meantime.

A sequence of integer fractions

This blog post is currently a notebook on Colab (click) ; eventually I ought to clean it up and move it here. Posting it here in the meantime.

Producing a "program trace" using GDB and Python

Sometimes, to understand what a program is doing, I’m tempted to add a log message at the start and end of every function, something like entering foo() and returning from foo() . When there are only a few functions this is easy enough to do manually, but if you want it for every function, some automation would be welcome. This could be automated using gcc’s -finstrument-functions ,…

Knuth's programming and problem-solving seminars

Looks like Knuth (and sometimes others) used to run a “Programming and Problem-Solving Seminar” at Stanford. Here’s a list (from DEK’s CV ), and the reports that are available.

Jon Bentley's "Programming Pearls" columns, and Van Wyk's "Literate Programming" columns in the CACM

Jon Bentley used to write a magazine column for the Communications of the ACM called “Programming Pearls” (later collected into two books). A spin-off was a column called “Literate Programming”, by Christopher J. Van Wyk. It is hard to find a list of all these columns, so I’m compiling a list here.

The Letter-Box (La boîte aux lettres) by René Bazin

While reading a beautiful post by Gowri Subramanya about birds, I remembered a story from one of our school textbooks, about a priest and his letter-box. Searching for relevant keywords found what appears to be the same story in a newer edition of the textbook on Google Books (or see as PDF here ). (I vaguely remembered an English priest and the Archbishop of Canterbury, but that may have just…

Another blurry image puzzle

Background Following up from a previous post , I got this: This request looks like an activity that might appeal to you, @svat ji! 😅 https://t.co/q4Mr8d3PvR — Arvind Iyer (@longhandnotes) October 20, 2019 (Click here to load the fancier Twitter display for the above tweets—makes a request to Twitter—if you want it for some reason.) I should really not make a habit of going on random chases…

Breaking pills

In a recent post , Mark Jason Dominus posed the following question: Suppose you have a bottle that contains \(N\) whole pills. Each day you select a pill at random from the bottle. If it is a whole pill you eat half and put the other half back in the bottle. If it is a half pill, you eat it. How many half-pills can you expect to have in the bottle the day after you break the last whole pill?

History of Indian mathematics: IIT Gandhinagar (2017)

There’s a nice series of videos on YouTube, here: https://www.youtube.com/playlist?list=PLRfu94TCePTtgPLfyysqQPMqdwyJvy0Vf According to the playlist title, it’s from “International Conference on Exploring the History of Indian Mathematics | December 4-6, 2017” All the talks are interesting if you are interested in Indian mathematics. 1 Many are of general interest. Below are just some…

The poem in the notepaper used for “Here Comes The Sun”

Background One day, after a few days of managing to avoid Twitter, I logged in and happened to see these: 👆🏾 @suhasm , Are you able to discern which verse it is that's illegibly rendered in the picture? — Arvind Iyer (@longhandnotes) September 5, 2019 and Not sure. Don't think its Sanskrit. Prolly Hindi — Suhas Mahesh (@suhasm) September 5, 2019 (Click here to load the fancier…

Don't mess with a genius

(Migrated from my older blog without any changes, as free wordpress.com blogs are infested with ads now.) Or: What happens when Newton’s laws are violated Recently, I read a book called Newton and the Counterfeiter , subtitled The Unknown Detective Career of the World’s Greatest Scientist . It focuses on an awesome phase of Isaac Newton’s later career that, like his pursuits in alchemy, gets…