Euclid’s theorem: Proof of Infinitely many primes

Also known as the Euclid’s theorem, the theorem of infinitely many primes is one of the most elegant ones around. I came across it while brushing up on discrete math and had to blog about it.
Let's try to explain a proof of this theorem.
Before we begin, lets revisit the following things: Any number can be written as a product of prime numbers as stated in the fundamental theorem of arithmetic.The number sets

Here we go!
To prove:There are infinite prime numbers
Let’s dispute that claim for a second and assume that we know all the prime numbers. Let’s write these as follows: P1P2P3….Pn
Lets try to form a new number Q the following way: Q = P1x P2x P3x….Pn+ 1

Now, Q can either be: PrimeNon primeWhy? Because any natural number > 1 has to be either prime or non prime.
If its: Prime, our list was incomplete as there is at least one more prime number and more prime numbers can be generated in a similar way. Contradiction!Non prime, we should still be able to write it in prime factorization form,…

Dynamic Programming Example

Dynamic programming problem explained and solved using C++.

I like programming in general, but the paradigm which appeals to me most is Dynamic programming. Back in 2013, during my college days, I used to  hone my skills by solving problems on CodeChef. But then I got a job and it does not involve a lot of DP.

Recently I've realized that I have become clumsy, and too used to the "safe life", hence I've decided to solve DP problems on HackerEarth, the purpose of this blog is to keep me motivated :p

Samu and Shopping

Samu is in super market and in a mood to do a lot of shopping. She needs to buy shirts, pants and shoes for herself and her family. There are N different shops. Each shop contains all these three items but at different prices. Now Samu has a strategy that she won't buy the same item from the current shop if she had already bought that item from the shop adjacent to the current shop. Now Samu is confused, because although she want to follow her strategy…

SAP Labs India Interview Experience

This is regarding the selection process of SAP labs for the 2014 batch.

The process was divided into two main parts
1: Online Test
2: Interviews

Online Test

 It had the following sections:

Quantitative Aptitude Basic Programming knowledge ( O.O concepts, Output prediction etc )EnglishCode ( Candidates had to write code for a problem statement ) Most candidates faced problems in the code section so I advice students to Practice writing code, preferably on Online code editors.


Students who cleared the written round were called for Interviews.
There were 4 interviews in total
Two technical one Managerial and one Hr.

The First Interview
The first interviews is to check the basic knowledge of almost all core subjects such as Data Structures,Operating Systems, DBMS etc.

O.O Concepts are of particular ImportanceQuestions will be asked on the basics of programming language(s) Of candidate's choice,the candidates are also expected to write code on paper for the Interviewer's pro…
littleBits Goes a Long Way

"The goal -- and challenge -- in this project was to create highly respectful, scientifically accurate projects that replicate NASA's groundbreaking work, while also making them modern, engaging and fun for nonscientists," said littleBits Product Designer Krystal Persaud. "We think this will empower people who were previously uninterested in STEM to get excited and get involved." Space fans the world over long have dreamed of exploring the universe for themselves, but a new, 12-module kit from NASA and littleBits aims to give enthusiasts a way to bring the thrill of space exploration closer to home. The new littleBits Space Kit, launched on Thursday, includes an assortment of electronic modules and NASA-designed projects and activities designed to allow anyone to observe and measure the universe, build and remotely control a model Mars Rover, or wirelessly send music to a model of the International Space Station.

"In 2012, NASA …

Gmail - Undo Send

You clicked send. Oh crap.

When you send a no-take-backs email — maybe an official email, or accidental reply-all — there's an instant pang of regret. It feels like there's no going back. Meet Gmail's Undo Send feature, a lifesaving little hack buried in the Gmail Labs settings. It gives you a 30-second window to "undo" sending an outgoing email. You just have to enable it first. Here's how it works:1. Click the gear icon in the top-right corner of your Gmail window and select Settings from the dropdown menu.
Gmail screenshot 2. Select Labs from the row of tabs.
Gmail screenshot 3. Scroll all the way to the bottom where you see Undo Send and click Enable.
Gmail screenshot 4. Hit Save Changes at the bottom. 5. Breathe easy. Now when you send an email, the yellow dialogue that displays "Your message has been sent" will also give you the option to Undo. Click it, and the email will reopen, un-sent, in the composition window.
Gmail screenshot It defaults so that…

Google says next version of Android will be called KitKat

Google says next version of Android will be called KitKat NEW DELHI: Sundar Pichai, head of Android division at Google, on Tuesday revealed on Twitter that the next version of the company's mobile operating system (OS) will be called Android KitKat.

"We now have over 1 billion Android activations and hope this guy in front of the building keeps that momentum going," Pichai tweeted as well as posted an image of a giant Android mascot built like KitKat chocolate.

Earlier, there were rumours that the next version of the OS would be called Android Key Lime Pie.

Since Android 1.5, Google has named each version of the OS after a sweet. Android 1.5 was Cupcake. Android 1.6 was Donut. Android 2.0 was Eclair. Android 2.2 was Froyo. Android 2.3 was Gingerbread. Android 3.0 was Honeycomb. Android 4.0 was Ice Cream Sandwich. And Android 4.1, 4.2 and 4.3 have been called Jelly Bean.

"Android is the operating system that powers over 1 billion smartphones and tablets…


Microsoft's Nokia deal: Layoffs look inevitable(read original) BANGALORE: Microsoft and Nokia's India operations are among the biggest outside their home countries, and it looks like a certain number of redundancies and consequent layoffs are inevitable. Microsoft CEO Steve Ballmer's email to Microsoft employees on the Nokia deal said the companies would integrate all global marketing and have a unified brand and advertising strategy. It said that finance, legal, HR, communications, evangelism, customer care and business development would integrate functionally at Microsoft. ICM/IT will also integrate functionally for traditional IT roles, it said.

Such integration in most cases implies redundancies. Nokia has 9,000 employees in India, almost a tenth of its global workforce. Microsoft has 6,000 employees here, out of its global strength of 97,000. It's unlikely that there will be much overlap at the engineering, support and R&D levels, because Noki…