Calculate Root of Any Whole Number in Java

The following Java program can find any root of a whole number. The logic is simple. Start by guessing some number and check if that is the correct value. If that overshoots then subtract some from the guess number else add to it. We add or subtract some fixed constant. If that constant is too […]

My Flickr Photostream

applegrew’s photostream on Flickr.

The Emperor’s Old Clothes

This is a republication from ACM’s archive of Prof. C. A. R. Hoare‘s lecture at 1980 ACM Turning Award. Prof. Hoare is popularly known for inventing QuickSort. The original piece can be found as PDF here. The primary reason for republishing this is the source PDF’s fonts. The PDF fonts are too horrible to read. […]

Quick bash command to mass rename files in numbered sequence

Just a quick bash command to rename all files in a directory in a numbered sequence. d=0; for i in *.jpg ; do d=$((d+1)); mv {“$i”,”$d.jpg”} ; done This is going to rename all jpg files in the directory to 1.jpg, 2.jpg, 3.jpg and so on.

Digit Math Application: Proving that all numbers ending with 5 are divisible by 5

Please read Digit Math: Introduction before you continue. The problem It seems I have developed a fascination for the number 5, so here we go again. Here I would be using Digit Math to prove that all integers  which end with digit 5 are always divisible by 5. The proof Case 1: Take a two […]

Digit Math Application: Proving that multiplying with 10**n puts n zeros at the end

Please read Digit Math: Introduction before you continue. The problem This is a very fundamental concept that we were taught when we were in junior schools. Now, think of it, what it says. If you add \(x\) ten times then you will get \(x\omega0\). If you add \(x\) hundred times then you will get \(x\omega00\); and so […]