3 Interesting 3-digit Numbers

Some numbers have really curious properties! Below are 3 such 3-digit numbers.


A palindromic number is a number (in some base b) that is the same when written forwards or backwards. Like 16461, for example, it is “symmetrical”. The term palindromic is derived from palindrome, which refers to a word (such as rotor or racecar) whose spelling is unchanged when its letters are reversed.
Take any positive integer of two digits or more, reverse the DIGITS , and add to the original number. Now repeat the procedure with the sum so obtained. This procedure quickly produces palindromic numbers for most integers. For example, starting with the number 5280 produces (5280, 6105, 11121,23232). The value for 89 is especially large, being 8813200023188. This process is sometimes called the 196-algorithm, after the most famous number associated with the process.
The first few numbers not known to produce Palindromes are 196, 887, 1675, 7436, 13783, which are simply the numbers obtained by iteratively applying the algorithm to the number 196. This number therefore lends itself to the name of the Algorithm. A Lychrel number is a natural number that cannot form a palindrome through this process. The name “Lychrel” was coined by Wade Van Landingham as a rough anagram of Cheryl, his girlfriend’s first name.
In 1990, a programmer named John Walker computed 2,415,836 iterations of the algorithm for the number 196, yielding a non-palindromic number with a million digits in length. This result has continually been improved over the years. In 1995, Tim Irvin used a supercomputer and reached the two million digit mark in only three months without finding a palindrome. Jason Doucette then followed suit and reached 12.5 million digits in May 2000. Wade VanLandingham used Jason Doucette’s program to reach 13 million digits. Since June 2000, Wade VanLandingham has been carrying the flag using programs written by various enthusiasts. By 1 May 2006, VanLandingham had reached the 300 million digit mark. Using distributed processing, in 2011 Romain Dolbeau completed a billion iterations to produce a number with 413,930,770 digits, and in February 2015 his calculations reached a number with billion digits. A palindrome has yet to be found.
With this insight, a more general question to be asked is: Do Lychrel numbers exist at all? If they do, their existence seems to be few and far between. In fact, through computational verification, about 90% of all natural numbers less than 10,000 are not Lychrel numbers. Of course, no matter how intuitive these results seem to be, in mathematics, computational calculation is not always the same as a proof.

The Sisyphus String: 123

Suppose we start with any natural number, regarded as a string, such as 9,288,759. Count the number of even digits, the number of odd digits, and the total number of digits. These are 3 (three evens), 4 (four odds), and 7 (seven is the total number of digits), respectively. So, use these digits to form the next string or number, 347. Now repeat with 347, counting evens, odds, total number, to get 1, 2, 3, so write down 123. If we repeat with 123, we get 123 again. The number 123 with respect to this process and the universe of numbers is a mathemagical black hole. All numbers in this universe are drawn to 123 by this process, never to escape.
But will every number really be sent to 123? Try a really big number now, say 122333444455555666666777777788888888999999999(or pick one of your own). The numbers of evens, odds, and total are 20, 25, and 45, respectively. So, our next iterate is 202,545, the number obtained from 20, 25, 45. Iterating for 202,545 we find 4, 2, and 6 for evens, odds, total, so we have 426 now. One more iteration using 426 produces 303, and a final iteration from 303 produces 123. At this point, any further iteration is futile in trying to get away from the black hole of 123, since 123 yields 123 again.


Euclidean Constructions are those constructions that can be completed using only a straight edge and a collapsing compass which closes when it is picked up. This collapsability causes problems because it means we cannot simply move a distance with a compass. There are three basic constructions that can be completed in Euclidean constructions. These constructions are:

  1. The straight line by connecting two points,
  2. A circle of a given radius centered at a given point or
  3. Continuing a segment infnitely.

From these given constructions a number of other constructions can be created. A constructible polygon is a regular polygon that can be constructed with compass and straightedge. For example, a regular pentagon is constructible with compass and straightedge while a regular heptagon is not.

The nth Fermat number is defines as:

F_n = 2^{2^n} + 1

The 17th-Century French lawyer and mathematician Pierre de Fermat incorrectly conjectured that all these numbers were primes, although he had no proof. The first 5 Fermat numbers: 3, 5, 17, 257, 65537 corresponding to n = 0,1,2,3,4 are all primes. These are called Fermat primes.
Some regular polygons are easy to construct with compass and straightedge; others are not. The ancient Greek mathematicians knew how to construct a regular polygon with 3, 4, or 5 sides and they knew how to construct a regular polygon with double the number of sides of a given regular polygon. This led to the question being posed: is it possible to construct all regular n-gons with compass and straightedge? If not, which n-gons are constructible and which are not?
Carl Friedrich Gauss proved the constructibility of the regular 17-gon in 1796. Five years later, he developed the theory of Gaussian periods in his Disquisitiones Arithmeticae. This theory allowed him to formulate a sufficient condition for the constructibility of regular polygons:
A regular n-gon can be constructed with compass and straightedge if n is the product of a power of 2 and any number of distinct Fermat primes (including none).
Although Gauss proved that the regular 17-gon is constructible, he did not actually show how to do it. The first construction is due to Erchinger, a few years after Gauss’ work. The first explicit constructions of a regular 257-gon were given by Magnus Georg Paucker (1822) and Friedrich Julius Richelot (1832). A construction for a regular 65537-gon was first given by Johann Gustav Hermes (1894). The construction is very complex; Hermes spent 10 years completing the 200-page manuscript.

Leave a comment

Two Pieces from Islamic History

Here are two pieces from early Islamic history that many Shia Muslims would not be knowing. I have taken it verbatim from an Urdu textbook on Islamic History by Dr Hameed-ud-Din.


Leave a comment

Another Interesting Excerpt


Leave a comment

An Interseting Excerpt


Leave a comment

Counting and the Mind

Here is an interesting fact taken verbatim from the book “A Passion for Mathematics” by Clifford A Pickover.


I quickly toss a number of marbles onto a pillow. You may stare at them for an instant to determine how many marbles are on the pillow. Obviously, if I were to toss just two marbles, you could easily determine that two marbles sit on the pillow. What is the largest number of marbles you can quantify, at a glance, without having to individually count them?


Seven. In 1949, Kaufman, Lord, Reese, and Volkmann flashed random patterns of dots on a screen. When subjects looked at patterns containing up to five or six dots, the subjects made no errors. The performance on these small numbers of dots was so different from the subjects’ performance with more dots that the observation methods were given special names. Below seven, the subjects were said to subitize; above seven, they were said to estimate. For more information, see E. L. Kaufman, M. W. Lord, T. W. Reese, and J. Volkmann, “The Discrimination of Visual Number,” American Journal of Psychology 62 (1949): 498–525. Also see George Miller, “The Magical Number Seven, Plus or Minus Two: Some Limits on Our Capacity for Processing Information,” The Psychological Review 63 (1956): 81–97.

Leave a comment

Advice for Patients and Family

Managing schizophrenia is a significant challenge. The immediate people effected are the patient himself and his family. Though I do not consider myself to be 100% cured, yet I feel that I am content with my life. It is almost 10 years since I was admitted in hospital for my first break. I have learned a lot through my experience with the disease. In this post I will be discussing some tips that may be helpful in coping with this mental disorder.

First of all, the family need to be patient. The disease take some time to develop and may take a considerably more time to recover. There is no magic pill. The medicine will also take time to relieve the symptoms. The family should realize that the thinking process of the patient is not the same as normal individuals. It is not the case that you tell the patient that you are thinking illogically and the patient accept that and that is end of it. Every patient goes into this illness in his own way and will recover in his own way.

The main advice for the patient is self counseling and self arguments. You may be extremely unlucky that you have been diagnosed with this serious illness, but that is not the end of life. Try to systematize your delusions. Try to identify those thoughts that do not make sense. Try to indulge in other healthy and interesting activities. Explore you interests and activities you enjoy. Make daily, weekly etc goals and chase them. Be proactive. Discuss your delusions with someone close to you. You may write them in a diary or start a blog like me.

If the medicine is not helping in relieving the symptoms, discuss with your doctor. It may take some time that you find the combination that works right for you. If the physician is not receptive, change the physician. I usually prefer the clinical psychologist over psychiatrist. The disease can be very well managed and the patients can spend healthy life. It may be the most serious disease in psychiatry but your fate is not doomed for good. Many people with this illness has demonstrated that they can very well be on the road to successful rehabilitation. Many such stories can be found on internet, books etc.

The main difficulty facing the family is how to handle the psychosis. The only thing that you can do is to keep silent and listen. The patient will believe in his delusion as the only truths. You can’t argue with the patient. The things may be obviously wrong and non sense to you, but those would be making perfect sense to the patient. If you want to correct him or streamline his thoughts and delusions, talk to the patient when he is in light mode. Try to make him realize his delusions gradually. He may systematize some of those. I personally think that my delusions will never be systematized completely. I keep on developing new one as I shed the old ones!

The last point that I wanted to discuss is the forced medication specially injections. I have been forced a few times and I consider them to be worst parts of my life. The shrinks may have different opinion on those but in my opinion these are violation of human rights and dignity. If the life of patient or someone else is in danger then they may be enforced. I never committed violence during my psychosis, but violence was committed against me by forced medication. My only message is to stop those. We are as human as any one else on this planet.

Leave a comment

My 3 Ingredients of Recovery

Schizophrenia is a complicated disease. It takes a considerable time to recover. I have never heard of it before. Though I have watched the Hollywood movie ‘A Beautiful Mind’ before my diagnosis, but I never bothered to know the name/pronunciation or nature of the disease. It was primarily my interest in Nobel prizes. It took almost 2 years to understand and accept the disease. The recovery was not rapid either. I tried to read books but it appeared to me that I was reading words. The comprehension was very low. I would boot the computer, see the monitor and could not make out what to do. The main concerns were the nature of the disease itself and future itself. Will I be ever able to overcome it? Gradually I tried to regroup my self around my interests. These are 3 main points which proved to be vital in my recovery.

I think Linux is/was my first love as described in this blog post. My admission in hospital put a break in it. I was admitted for too long, about a year. There was no counseling at all by the psychiatrists. My path to recovery was my own struggle with the considerable help from my family. I forgot about many commands, steps and tricks about Linux. Though I had it installed but I rarely used it. I was a regular reader of Linux Weekly News, but my admission put a break of about a year. I was unaware of recent developments. I bought the DVD of Fedora 7 and gradually refreshing my skills. It was the first distribution I installed after my diagnosis. Gradually I have ‘another’ interest besides my illness and future prospects.

As discussed, I had difficulty in reading and comprehending books. I started feeling that I would not be able to learn new things. Comprehension was low but I kept trying. Programming was one of my strong points. We learned FORTRAN in our studies. I did my project in Visual Basic. I had not used them for a while, so I had forgotten about them. I had saved some notes on C programming by my project adviser Omar Bashir that can be found here. I decided to learn C using these notes. The notes are beautifully written. As I started reading, I was able to comprehend and understand them well. This gave me confidence that I could understand new things and the disease can be managed.

My third ingredient is related to internet usage. I had kept the usage of internet to my interests mainly Linux, science history and engineering. I was a fan of mit opencourseware. But I was slow to adopt the other sides of the internet, the world of free books and torrents. I started categorizing and saving my data since my days in Army. It had a very few books. My younger brother, Yasir introduced me to a giant folder that contained a lot of math books and tutorials. He has collected them from one of his friends. This started my quest for free books. I started searching the internet for sites dedicated to books. The 4 main sites that I used were rapidshare, gigapedia, ebookshare and freebookspot. The first 3 have been closed. From these I have learned a lot.

These were not the only factors in my recovery. They proved to be crucial. The thing which is/was above all, was the support of my family specially my parents.



Some Mathematical GIFs

Here are some GIFs I have collected over internet that explain mathematical ideas. The following GIF explain what is meant by tangent/parallel lines and asymptotes.


The following GIF explains how to construct a regular heptagon using straight edge and compass.


The following 2 GIFs explain what an ellipse is and how to draw it.



The area of the circle with unit radius is \pi and so is the circumference of the circle with unit diameter. The following 2 GIFs illustrate that.



The following GIF explain a method to find the Golden Ratio (\phi).


The following 3 GIFs are the illustrations of Pythagorean Theorem.



If you move along a unit circle with center at origin, then its coordinates are (\cos \theta, \sin \theta ). The following 3 GIFs exploit this fact.




The following GIF explains that how a sine wave is compressed or expanded if its period is changed.


The following GIF explain how to plot a graph by moving from rectangular to polar coordinates.


The following 2 GIFs demonstrate the creation of cardoid. In first a cardoid is obtained by rotating a circle around one of half its radius. The second one shows a parametric equation for the curve.



The following two GIFs demonstrate the creation of hypotrochoids.



In the following GIF, circles of radius 1 and 3 roll together along a straight line, tracing out a fixed cycloid along with rotating cardioids and deltoids.


The animation illustrates the Gram-Schmidt process for obtaining an orthonormal basis of vectors for 3-dimensional euclidean space.


All differential functions are continuous but not vice versa. The following animation shows a continuous function that is not differential at zero.


Taylor series is used for approximation of functions. The following 2 animations show a sinusoid and its Taylor polynomials of different orders.


The following 2 animations demonstrates the Fourier Series and Transform.It demonstrates how a series of waves with increasing frequencies, and carefully chosen decreasing amplitudes, adds up to give a square wave with flat peaks and troughs. Fourier analysis provides a method for choosing the amplitudes of the waves.



The last 3 GIFs are misc curves. The last one is the batman curve.




Leave a comment

3 interesting GIFs

Here are 3 interesting GIFs I find very amusing.



Leave a comment

Spherical Trigonometry and Navigational Calculations


Navigation is the process of planning, recording, and controlling the movement of a craft or vehicle from one location to another. The word derives from the Latin roots navis (“ship”) and agere (“to move or direct”). To achieve these goals in a general way, a coordinate system is needed that allow quantitative calculations. The most commonly used notation involves latitudes and longitudes in a spherical coordinate system. Spherical Trigonometry deals with triangles drawn on a sphere The development of spherical trigonometry lead to improvements in the art of earth-surfaced, orbital, space and inertial navigation, map making, positions of sunrise and sunset, and astronomy.


Spherical trigonometry was dealt with by early Greek mathematicians such as Menelaus of Alexandria who wrote a book that dealt with spherical trigonometry called “Sphaerica”. The subject further developed in the Islamic Caliphates of the Middle East, North Africa and Spain during the 8th to 14th centuries. It arose to solve an apparently simple problem: Which direction is Mecca? In the 10th century, Abu al-Wafa al-Buzjani established the angle addition identities, e.g. \sin (\alpha + \beta), and discovered the law of sines for spherical trigonometry. Al-Jayyani (989-1079), an Arabic mathematician in Islamic Spain, wrote what some consider the first treatise on spherical trigonometry, circa 1060, entitled “The Book of Unknown Arcs of a Sphere” in which spherical trigonometry was brought into its modern form. This treatise later had a strong influence on European mathematics. In the 13th century, Nasir al-Din al Tusi (1201–74) and al-Battani, continued to develop spherical trigonometry. Tusi was the first (c. 1250) to write a work on trigonometry independently of astronomy. The final major development in classical trigonometry was the invention of logarithms by the Scottish mathematician John Napier in 1614 that greatly facilitated the art of numerical computation – including the compilation of trigonometry tables.

Navigational Terminology

Although the Earth is very round, in fact, it is a flattened sphere or spheroid with values for the radius of curvature of 6336 km at the equator and 6399 km at the poles. Approximating the earth as a sphere with a radius of 6370 km results in an actual error of up to about 0.5%. The flattening of the ellipsoid is ~1/300 (1/298.257222101 is the defined value for the GPS ellipsoid WGS-84). Flattening is (a-b)/a where a is the semi-major axis and b is the semi-minor axis. The value of a is taken as 6378.137 km in GPS ellipsoid WGS-84.

The position of a point on the surface of the Earth, or any other planet, for that matter, can be specified with two angles, latitude and longitude. These angles can be specified in degrees or radians. Degrees are far more common in geographic usage while radians win out during the calculation.

Latitude is the angle at the center of the Earth between the plane of the Equator (0^o latitude) and a line through the center passing through the surface at the point in question. Latitude is positive in the Northern Hemisphere, reaching a limit of +90^o at the North Pole, and negative in the Southern Hemisphere, reaching a limit of -90^o at the South Pole. Lines of constant latitude are called parallels. Longitude is the angle at the center of the planet between two planes passing through the center and perpendicular to the plane of the Equator. One plane passes through the surface point in question, and the other plane is the prime meridian (0^o longitude), which is defined by the location of the Royal Observatory in Greenwich, England. Lines of constant longitude are called meridians. All meridians converge at the north and south poles (90^oN and -90^oS). Longitudes typically range from -180^o to +180^o. Longitudes can also be specified as east of Greenwich (E or positive) and west of Greenwich (W or negative). Figure 1 illustrates the typical latitudes and longitudes on Earth. In spherical or geodetic coordinates, a position is a latitude taken together with a longitude, e.g., (lat, lon), which defines the horizontal coordinates of a point on the surface of a planet. Azimuth or bearing or true course is the angle a line makes with a meridian, taken clockwise from north. Usually azimuth is measured clockwise from north (0 = North, 90 = East, 180 = South 270= West, 360=0=North).

latlongFigure 1: Typical latitude and longitude values on earth surface

A rhumb line is a curve that crosses each meridian at the same angle. Although a great circle is a shortest path, it is difficult to navigate because your bearing (or azimuth) continuously changes as you proceed. Following a rhumb line covers more distance than following a geodesic, but it is easier to navigate. Unlike a great circle which encircles the earth, a pilot flying a rhumb line would spiral indefinitely poleward. The rumb line formulas are more complicated and will not be discussed.

Spherical Trigonometry

Great/Small Circles and Geodesic

Any plane will cut a sphere in a circle. A great circle is a section of a sphere by a plane passing through the center. Other circles are called small circles. All meridians are great circles, but all parallels, with the exception of the equator, are not. There is only one great circle through two arbitrary points that are not the opposite endpoints of a diameter. The smaller arc of the great circle through two given points is called a geodesic, and the length of this arc is the shortest distance on the sphere between the two points. The great circles on the sphere play a role similar to the role of straight lines on the plane.

Spherical Triangle

A figure formed by three great circle arcs pairwise connecting three arbitrary points on the sphere is called a spherical triangle or Euler triangle as shown in Figure 2. The vertices of the triangles are formed by 3 vectors (\vec{OA},\vec{OB},\vec{OC}). The angles less than \pi between the vectors are called the sides a, b and c of a spherical triangle. To each side of a triangle there corresponds a great circle arc on the sphere. Each pair of vectors forms a plane. The angles A, B and C opposite the sides a, b and c of a spherical triangle are the angles between the great circle arcs corresponding to the sides of the triangle, or, equivalently, the angles between the planes determined by these vectors.

sphtrgFigure 2: A spherical triangle on a sphere

Spherical Triangle and Navigation

In navigation applications the angles and sides of spherical triangles have specific meanings. Sides (a, b or c) when multiplied by the radius of the Earth gives the geodesic distances between the points. By definition one nautical mile is equivalent to 1min of latitude extended at the surface of Earth. When one point is the North pole, the two sides originating from that point (b and c in Figure 2) are the co-latitudes of the other two points. The angles at the other two points (B and C in Figure 2) are the azimuth or bearing to the other point.

Spherical Triangle Formulas

Most formulas from plane trigonometry have an analogous representation in spherical trigonometry. For example, there is a spherical law of sines and a spherical law of cosines. Let the sphere in Figure 2 be a unit sphere. Then vectors \vec{OA}, \vec{OB} and \vec{OC} are unit vectors. We take OA as the Z-axis, and OB projected into the plane perpendicular to OA as the X-axis. Vectors \vec{OB} and \vec{OC} has components (\sin c, 0, \cos c) and (\sin b \cos A, \sin b \sin A, \cos b) respectively. From dot product rule:

\cos a = \vec{OB} \bullet \vec{OC}
\cos = (\sin c, 0, \cos c) \bullet (\sin b \cos A, \sin b \sin A, \cos b)

This gives the identity (and its two analogous formulas) known as law of cosines for sides.

\cos a = \cos b \cos c + \sin b sin c \cos A
\cos b = \cos c \cos a + \sin c sin a \cos B
\cos c = \cos a \cos b + \sin a sin b \cos C

Similarly by using the \sin formula for vector cross product we get the law of sines.

\frac{\sin A}{\sin a} = \frac{\sin B}{\sin b} = \frac{\sin C}{\sin c}

The law of cosines for angle is given by.

\cos A = -\cos B \cos C + \sin B \sin C \cos a
\cos B = -\cos C \cos A + \sin C \sin A \cos b
\cos C = -\cos A \cos B + \sin A \sin B \cos c

There are numerous other identities. All these identities allow us to solve the spherical triangles when appropriate angles and sides are given.

The sum of the angles of a spherical triangle is between \pi and 3\pi radians (180^o and 540^o). The spherical excess is defined as E = A + B + C - \pi, and is measured in radians. The area A of spherical triangle with radius R and spherical excess E is given by the following Girard’s Theorem.

A = R^2E

The spherical geometry is a simplest model of elliptic geometry, which itself is a form of non-Euclidean geometry, where lines are geodesics. It is inconsistent with the “parallel line” postulate of Euclid. In the elliptic model, for any given line l and a point A, which is not on l, all lines through A will intersect l. Moreover the sum of angles in the triangle will be greater than 180^o. For example for two of the sides, take lines of longitude that differ by 90^o. For the third side, take the equator. This gives us a triangle with an angle sum of 270^o.

Navigational Calculations

Distance and Bearing Calculation

The problem of determining the distance and bearing can easily be calculated. Let point B and C have positions (lat1, lon1) and (lat2, lon2) respectively. Let point A be the North Pole as shown in Figure 2. The angle A is the difference between the longitudes. Moreover the sides b and c are (90^o - lat1) and (90^o - lat2) respectively. Keeping theses in mind and using law of cosines for sides we get.

\cos a = \sin (lat1) \sin (lat2) + \cos (lat1) \cos (lat2) \cos (lon2 - lon1)

Taking \cos^{-1} we get the value of side a between 0 and \pi radians. By multiplying it with the radius of earth we get the required distance. The triangle can be solved for all sides. The angle B is the bearing from B to C. The values of \sin B and \cos B can be calculated using the flowing relations.

\cos B = \cos (lat2) \sin (lon2 - lon1)
\cos B = \cos (lat1) \sin (lat2) - \sin (lat1) \cos (lat2) \cos (lon2 - lon1)

The angle B can be computed using two-argument inverse tan function (usually denoted by tan2^{-1} or atan2), which gives the value between \pi and -\pi radians.

Dead Reckoning

Dead reckoning (DR) is the process of estimating one’s current position based upon a previously determined position, or fix, and advancing that position based upon known speed, elapsed time (or distance) and course. In studies of animal navigation, dead reckoning is more commonly (though not exclusively) known as path integration, and animals use it to estimate their current location based on the movements they made since their last known location. Here we present the algorithm to compute the position of the destination if the distance and azimuth from previous position is known. Let the starting point has position (lat, lon). The azimuth from starting point is azm and the angular distance covered is dis in radians. Let the position of the destination be (newlat, newlon). Then latitude can be calculated by

newlat = \sin^{-1}(\sin (lat) \cos (dis) + \cos (lat) \sin (lat) \sin (dis) \cos (azm)

The calculation of longitude can be carried out as under.

lon1 = lon + tan2^{-1}(\sin (dis) \sin (azm), \cos (lat) \cos (dis) - \sin (lat) \sin (dis) \cos (dis)

The value of lon1 can be outside the range of \pi and \pi radians. The function angpi2pi brings it in the required range.

newlon = angpi2pi(lon1)


Spherical trigonometry is used for most calculations in navigation and astronomy. For the most accurate navigation and map projection calculation, ellipsoidal forms of the equations are used but these equations are much more complex. Dead reckoning is used extensively in Inertial Navigation Systems (INS). Spherical trigonometry along with linear algebra forms the backbone for modern navigation systems such as GPS. It is a prerequisite for good understanding of GIS. It is much more pertinent to integrate course of spherical trigonometry in the engineering curriculum.

Note: This is the edited version of the paper I presented at Institute of Space Technology in end 2008. You can download the associated paper from here and PowerPoint presentation from here.

, ,

Leave a comment

%d bloggers like this: