Childhood Maths – I

Standard

I found two documents that I was very proud of as a child. Both were the result of trying to understand the kind of things Ramanujan did in free time, a result of the little AMTI books I read as a child. I will share one document in this post and another one in the next since both are not related to each other in substance.

Following is a calculation table generated using some spreadsheet software:

As you can see, it was motivated by the famous Taxicab number story.

Different representations of a number as sum of squares

Standard

A couple of weeks ago, I wrote a post on Ramanujam’s 129th birthday. In that post I couldn’t verify the fact that:

129 is the smallest number that can be written as the sum of 3 squares in 4 ways.

So I contacted Sannidhya, the only good programmer I know . He wrote a program in Python which finds all numbers less than 1000 that can be written as sum of three squares. Here is the program :  https://repl.it/EzIc

Now, we can conclude that 129 is the smallest such number and the next is 134.

Let’s try to understand, how this program works. Firstly, the sumOfSquares(n) procedure finds all a, b such that n = a^2 + b^2. Then the sumOfSquares3(n) procedure finds all a,b,c such that n = a^2 + b^2 + c^2. It works by repeatedly invoking sumOfSquares on (n-i^2) where i is incremented after each iteration from 1 to square root of n/3. Finally, we run a loop up to 1000 and find those number for which sumOfSquares3 returns 4 triplets (a,b,c). Similarly, one can also find numbers which can be expressed as sum of 3 squares in 5 different ways. The smallest one is 194, with the 5 triplets being (1, 7, 12), (3, 4, 13), (3, 8, 11), (5, 5, 12) and (7, 8, 9).
But how does the functions sumOfSquares(n) and sumOfSquares3(n) work? This is how Sannidhya explains:

The SumOfSquares(n) finds all the unordered pairs (a, b), such that a^2 + b^2 = n. It works by subtracting a perfect square (i^2) from n, and checking if the remaining part is a perfect square as well. If so, then (i, sqrt(n-i^2)) will form a required unordered pair. Here, i loops from 1 to square root of n/2. Note: One can also loop from 1 to square root of n but after square root of n/2, further iterations will generate redundant pairs which are just permutations of the pairs already obtained. For example, consider 25, the expected output should be (3,4) only, but if the loop runs from 1 to square root of n, then the output will be (3, 4), (4, 3). As you can see we are getting redundant pairs. So, we run the loop from 1 to square root of n/2.

The SumOfSquares3 function calls SumOfSquares repeatedly with the argument n – i^2, where i is incremented from 1 to square root of n/3. Note that each element of SumOfSquares(n – i^2) is a pair. For each of these elements, the loop forms a triplet consisting of i and the pair. This triplet is then appended to the list, which is finally returned.

The repetitions of triplets can easily be controlled by using sorted function from Python in sumOfSquares3(n).

Indeed, these type of question are a bit hard computationally. For example, see:

Related discussions on MathOverflow:

– Is there a simple way to compute the number of ways to write a positive integer as the sum of three squares? : Note that this is not answer of my question since $r_k(n)$ counts the number of representations of $n$ by $k$ squares, allowing zeros and distinguishing signs and order.

Related discussions on ComputerScience.SE

– Listing integers as the sum of three squares $m=x^2+y^2+z^2$ : Sannidhya did a clever improvement to this algorithm, but still as pointed here, Sannidhya’s algorithm is of O(n).

Related discussions on Mathematics.SE

Happy Birthday Ramanujam

Standard

Today is 129th birthday of Srinivasa Ramanujam Iyengar. Let’s see some properties of the number 129:

♦  It is sum of first ten prime numbers. [Tanya Khovanova’s “Number Gossip”]

$\displaystyle{2+3+5+7+11+13+17+19+23+29 = 129}$.

♦  It is the smallest number that can be written as the sum of 3 squares in 4 ways. [Erich Friedman’s “What’s Special About This Number?”]

$\displaystyle{11^2+2^2+2^2 = 10^2+5^2+2^2 = 8^2+8^2+1^2 = 8^2+7^2+4^2 = 129}$.

Though the first property appears like a coincidence (to me!), but the second fact is connected to a well-known theorem in number theory.

Legendre’s three-square theorem: A non-negative integer $n$ can be represented as sum of three squares of integers if and only if $n$ is NOT of the form $4^a (8b+7)$ for some integers $a$ and $b$.

Therefore, to make sure that a number can be written as sum of three squares or not, we just need to check its divisibility with 4 and 8. Since 129 is a small number (and a multiple of 3) we can easily factorize it as $129 = 3 \times 43$.  Now, since 4 is not a factor, we get $a=0$ and just need to check $8b+7= 129 = 8\times 16 + 1$, but no integer $b$ can satisfy this condition. Completing the verification of our example.

It’s not difficult to prove that no integer $n=4^a(8b+7)$ can be sum of three squares. But, it’s difficult to prove the converse of this statement. Till now I didn’t know the complete proof of this theorem. Interestingly, the two available proofs use some deep results like:

◊  quadratic reciprocity law + Dirichlet’s theorem on arithmetic progressions + equivalence class of the trivial ternary quadratic form.

◊  quadratic reciprocity law + Minkowski’s theorem on lattice points contained within convex symmetric bodies + Fermat’s theorem on sums of two squares

I would prefer proving this result using second approach, since proving Dirichlet’s theorem is very difficult (as compared to the main theorem we wish to prove). The proof using second approach was given by Nesmith . C. Ankeny, in  “Sums of Three Squares,” Proceedings of the American Mathematical Society, vol. 8, no. 2, p. 316, Apr. 1957. Also, note that Ankeny prove the three-square theorem only when $n$ is square-free because it’s easy to prove that

Lemma: If an integer is a sum of squares of three positive integers, so is its square.

For proof see this article by Alexander Bogomolny, “Sum of Three Squares” from Interactive Mathematics Miscellany and Puzzles

Now, what remains to determine is the number of ways we can write a non-negative integer which satisfies Legendre’s three-square theorem as sum of three squares. Interestingly, this is a research level problem if we are talking about a formula to calculate the number of presentations of a given number as sum of three squares. Indeed, there is a (very long) paper by Paul T. Bateman titled “On the Representations of a Number as the Sum of Three Squares”, Transactions of the American Mathematical Society, Vol. 71, No. 1 (Jul., 1951), pp. 70-101. Though I didn’t have patience to read this paper, this MathOverflow discussion gives an overview of the Sum of Squares Function. The output of this function is available as A005875: Number of ways of writing a nonnegative integer n as a sum of 3 squares (zero being allowed) but it is useless since it counts the “tuples”. For example, 129 can be represented by 144 =  (3+6+6+3)8 tuples because we are allowed to replace positive by negative integers before squaring them (hence multiplied by 8).

So, we will have to “manually” check the number of ways we can write the non-negative integers less than 129 as sum of three squares (A000408: Numbers that are the sum of three nonzero squares). As of now, I don’t know how to find the distinct representations. Will try to answer this question in future.

Celebrity Mathematicians

Standard

In my opinion, currency notes are one of the biggest motivation to learn arithmetical operations (like addition, multiplication,…). In fact, most of our elementary school problems are about buying a particular quantity of something.

Historically, there had been currencies notes featuring great mathematicians like Carl Friedrich Gauss, Leonard Euler and Rene Descartes. But, today there are no currencies featuring mathematicians. The database of currency notes featuring mathematicians is available here: http://web.olivet.edu/~hathaway/math_money.html

Since honouring people by featuring them on currency notes is politically challenging, government rather issues special postage stamps. The database of stamps featuring mathematicians is available here:  http://jeff560.tripod.com/stamps.html

Apart from illustrating various mathematical concepts (like graphs, metric system, binomial theorem… ) on stamps, India Post has issued stamps to honour mathematicians like Damodar Dharmananda Kosambi , Srinivasa Ramanujan Iyengar and Bertrand Russell.

Happy Birthday Ramanujam

Standard

Today is 128th birthday of Srinivasa Ramanujam Iyengar.

[Please note that Britishers gave wrong English spelling for his name, they called him “Ramanujan”,  but it should be “Ramanujam” which means  “The younger brother of Lord Rama”]

John Littlewood said (as recalled by G. H. Hardy (1921), in “Obituary Notices: Srinivasa Ramanujan”, Proceedings of the London Mathematical Society 19, p. lvii) :

Every positive integer is one of Ramanujan’s personal friends.

So, let’s talk about numbers on his birthday.

128 is 7th power of 2 and leads to 4th Mersenne Prime ($2^7 - 1=127$ is a prime)

128 is the largest number which is not the sum of distinct squares. [https://oeis.org/A001422]

and here is my present for him:

RAMANUJAM’S MAGIC SQUARE

When I was in High School, I learned making such “Special Date Magic Squares” form P.K. Srinivasan’s (1924-2005) book regarding Ramanujam’s work. [see: https://nrich.maths.org/1380 ]

Magic sum of this square is 69. Thus all rows, columns and diagonals add up to the same total of 69 and today’s date has been placed in first row.

69 is a value of $n$ where $n^2$ and $n^3$ together contain each digit once. Since, $69^2=4761$ and $69^3 = 328509$

Ramanujam also studied “Partition Function”, this function gives the number of ways of writing the integer n as a sum of positive integers, where the order of addends is not considered significant. Observe that, in the magic square above we created 10 distinct 4-partitions of 69. (though 2376 distinct 4-partitions of 69 are possible!!)

Also, the total sum of numbers in our magic square is $69\cdot 4 = 276 = 1^5 + 2^5 + 3^5$

Once more, Happy Birthday Ramanujam!

Standard

One night after hectic schedule at college, I was standing in front of black board with a chalk in my hand (to relax my mind!).

A thought of nested roots came to my mind and I wrote:
$\sqrt{2 +\sqrt{2 +\sqrt{2 + \ldots}}} = 2$
As I had `learnt’ from some olympiad book in class 8, the trick to solve such problems.
Let, $\sqrt{2 +\sqrt{2 +\sqrt{2+ \ldots}}} = x$
As we have infinite number of terms on left hand side, if we keep one of the two’s aside, we can rewrite it as:\\
$\sqrt{2 + x} = x$
$\Rightarrow 2 + x = x^2$
Solving this quadratic we will get $x = 2, -1$
Clearly $x\geq 0$, thus $x = 2$.
Now thrilled by this I proceeded to evaluate nested roots for other arithmetic operations in similar fashion:
$\sqrt{2 -\sqrt{2 -\sqrt{2 - \ldots}}} = 1$
$\sqrt{2\sqrt{2\sqrt{2\ldots}}} = 2$
$\sqrt{\frac{2}{\sqrt{\frac{2}{\sqrt{\frac{2}{\vdots}}}}}} = \sqrt[3]{2}$
Now I knew that no one knows the answer for:
$1-1+1-1+1-1\ldots = ??$
so, inspired by this I wrote:
$\sqrt{1-\sqrt{1 +\sqrt{1-\ldots}}} = ??$
But then one of my friend suggested:

Since we are dealing with infinite terms we can say

$\sqrt{1-\sqrt{1 +x}} = x$
$\Rightarrow 1-\sqrt{1 +x} = x^2$
$\Rightarrow x^4 - 2x^2 - x = 0$
$\Rightarrow x(x^3 - 2x - 1) = 0$
$\Rightarrow x(x+1)(x^2-x-1) = 0$
$\Rightarrow x = 0, -1, \frac{1+\sqrt{5}}{2}, \frac{1-\sqrt{5}}{2}$
But I can’t say which one out of  $0\quad \& \quad \frac{1+\sqrt{5}}{2}$ is solution.
I know that flaw in this argument is similar to that in saying:
$1-1+1-1+1-1\ldots = 0$, by pairing $+1\quad \& \quad -1$.
But I found the idea itself flawless and tried to apply it to my starting expression:
$\sqrt{2 +\sqrt{2 + x}} = x$
$\Rightarrow 2 + \sqrt{2 + x} = x^2$
$\Rightarrow x^4 - 4x^2 - x +2 = 0$
$\Rightarrow (x-2)(x+1)(x^2 + x -1) = 0$
$\Rightarrow x = 2, - 1, \frac{-1-\sqrt{5}}{2}, \frac{-1+\sqrt{5}}{2}$
Unlike last case I can decide between $2\quad \& \quad \frac{-1+\sqrt{5}}{2}$  [Thanks to Sagar Shrivastava]

Since, $\sqrt{2 +\sqrt{2 +\sqrt{2+ \ldots}}} > \sqrt{2} > \frac{-1+\sqrt{5}}{2}$

Thus if I take out more and more 2’s out of square root, I will get more and more values of $x$ and among them we will get only one appropriate value of $x$.

But still I can’t figure out the correct value of$\sqrt{1-\sqrt{1 +\sqrt{1-\ldots}}}$ since I don’t have much experience with ‘series’ at this stage, but will surely investigate this question in detail by end of this semester.
If you have some ideas regarding this please do share.

Also these nested roots remind me of Ramanujam’s famous problem:
Find the value of : $\sqrt{1+2\sqrt{1+3\sqrt{1+4\sqrt{\ldots}}}}$  (See this article by B. Sury)

Happy Birthday Ramanujam

Standard

Today is 127th birthday of our beloved mathematician Srinivasa Ramanujam Iyenger.
To celebrate his birthday I would like to pose a puzzle to all the readers and urge you  to solve it in your head, as Ramaujam did!!

In a certain street, there are more than fifty but less than five hundred houses in a row, numbered from 1, 2, 3 etc. consecutively. There is a house in the street, the sum of all the house numbers on the left side of which is equal to the sum of all house numbers on its right side. Find the number of this house.

[Hint: Ramanujam used concept of continued fractions]