### Mathematics for Programmers 1 :Prime Numbers

A prime number (or prime integer, often simply called a "prime" for short) is a positive integer 1" border="0" height="15" width="33"> that has no positive integer divisors other than 1 and itself. (More concisely, a prime number is a positive integer having exactly one positive divisor other than 1.) For example, the only divisors of 13 are 1 and 13, making 13 a prime number, while the number 24 has divisors 1, 2, 3, 4, 6, 8, 12, and 24 (corresponding to the factorization ), making 24 not a prime number. Positive integers other than 1 which are not prime are called composite numbers.

Prime numbers are therefore numbers that cannot be factored or, more precisely, are numbers whose divisors are trivial and given by exactly 1 and .

The number 1 is a special case which is considered neither prime nor composite (Wells 1986, p. 31). Although the number 1 used to be considered a prime (Goldbach 1742; Lehmer 1909; Lehmer 1914; Hardy and Wright 1979, p. 11; Gardner 1984, pp. 86-87; Sloane and Plouffe 1995, p. 33; Hardy 1999, p. 46), it requires special treatment in so many definitions and applications involving primes greater than or equal to 2 that it is usually placed into a class of its own. A good reason not to call 1 a prime number is that if 1 were prime, then the statement of the fundamental theorem of arithmetic would have to be modified since "in exactly one way" would be false because any . In other words, unique factorization into a product of primes would fail if the primes included 1. A slightly less illuminating but mathematically correct reason is noted by Tietze (1965, p. 2), who states "Why is the number 1 made an exception? This is a problem that schoolboys often argue about, but since it is a question of definition, it is not arguable." As more simply noted by Derbyshire (2004, p. 33), "2 pays its way [as a prime] on balance; 1 doesn't."

With 1 excluded, the smallest prime is therefore 2. However, since 2 is the only even prime (which, ironically, in some sense makes it the "oddest" prime), it is also somewhat special, and the set of all primes excluding 2 is therefore called the "odd primes." Note also that while 2 is considered a prime today, at one time it was not (Tietze 1965, p. 18; Tropfke 1921, p. 96).

The th prime number is commonly denoted , so , , and so on.

The first few primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ...
A mnemonic for remembering the first seven primes is, "In the early morning, astronomers spiritualized nonmathematicians"

In the Season 1 episode "Prime Suspect" (2005) of the television crime drama NUMB3RS, math genius Charlie Eppes realized that character Ethan's daughter has been kidnapped because he is close to solving the Riemann hypothesis, which allegedly would allow the perpetrators to break essentially all internet security by factoring large numbers.

The numbers of decimal digits in for , 1, ... is given by 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...

Source :http://mathworld.wolfram.com

### How to Install Hadoop (2.7.3) on Ubuntu (16.04 LTS)

As I am planning to learn Hadoop, I wanted to install Hadoop (2.7.3) on my Ubuntu (16.04 LTS) and I followed the steps mentioned in the documentation on the Apache Hadoop website. I encountered few problems which are mentioned below, spent some time finding solution to them.

Below are the steps I followed and the description of the error is at the end of this post and also I have mentioned what I missed and what caused these errors.

This will extract the files into a folder  "hadoop-2.7.3" .

Step 3. I moved the file to /home/<username> folder (many suggest to move it into /usr/local but I prefer to keep it here, may be once I learn more about linux I might get into tha…

### Javascript KeyCode Reference table for Event Handling

The post explains Keyboard event handling using javascript.Javascript events are used to capture user keystrokes. Below is a table of key codes for the keys on a multimedia keyboard. If this table is inconsistent with your own findings, please let me know.

Java Script Code to Find Key code

<script language="JavaScript">
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
}
</script>

Key Code Reference Table
Key PressedJavascript Key Codebackspace8tab9enter13shift16ctrl17alt18pause/break19caps lock20escape27page up33page down34end35home36left arrow37up arrow38right arrow39down arrow40insert45delete46048149250351452553654755856957a65b66c67d68

### Replacing OpenJDK with Oracle JDK in Ubuntu

You can completely remove the OpenJDK and fresh Install Oracle Java JDK by the following steps:
Remove OpenJDK completely by this command:
To find which version is your OS, check hereCreate a folder named java in /usr/local/by this command:
sudo mkdir -p /usr/local/javaCopy the Downloaded file in the directory /usr/local/java. To do this, cd into directory where downloaded file is located and use this command for copying that file to /usr/local/java/:
sudo cp -r jdk-8u51-linux-x64.tar.gz /usr/local/java/CD into /usr/local/java/ directory and extract that copied file by using this command:
sudo tar xvzf jdk-8u51-linux-x64.tar.gzAfter extraction you must see a folder named jdk1.8.0_51.Update PATH file by opening /etc/profile file by the command sudo nano /etc/profile and past…