Some Simple Prime Number Proofs

The number 2 is the only even prime number.

Suppose there is a prime number that is even other than 2. That prime number must not be divisible by 2 or else it would not be prime since 2 is a prime number. However all even numbers are divisible by 2. Hence, as a result there can not be a prime number that is even other than 2. In other words, 2 is the only even prime number.

Read more »

Proof of the Binomial Theorem

Let's recall what the binomial theorem states. The theorem gives us a formula for calculating the expansion of a binomial made up of first degree monomials (i.e. expansion of \((x+y)^n\)). What's a binomial or a monomial for that matter? Let's start with a monomial. A monomial is an expression like \(y^2\); more complex monomials can be written, but they won't apply to this theorem. A first degree monomial is anything like \(x,y,z\). Easy, right? Pascal appears rather celebrated in this domain. He has something called Pascal's triangle named after him. To avoid getting sidetracked I will refer the interested reader to Wikipedia for a great discussion on Pascal's triangle. https://en.wikipedia.org/wiki/Pascal's_triangle

Read more »

Euclid's Proof that there are an Infinite Number of Primes

Proving these results from classic number theory are useful for many reasons. For one, they prepare you for the study of cryptography. It never hurts to study cryptography now does it? Second, they are fun and interesting to boot. The latter reason is enough if you ask me.

Read more »

Why Linear Search is O(n) – A Bit Mathy

OK this won’t hurt. I don’t want to hurt my readers. But I think it’s time we get a little serious. Alright not serious but lets tackle something a little harder than normal. Let’s analyze linear search? Why not? Oh no, you would rather watch Scandal. I’ll tell you the punchline. The president falls deeply in love with his mistress, Kerry Washington but never marries her as the plot would end.

Read more »

Making "Classes" in C using Function Pointers and Pseudo Closures

Who doesn’t want to write pseudo classes in C? A nice exercise is to do it once even if you plan to never do it again. Doing so you will have a greater appreciation for function pointers and what I am calling the pseudo closure idiom in C – passing a variable to emulate “private” data members. C doesn’t come with closures or almost anything for that matter. It is a very minimalist language which is, of course, one of its strengths and at times a weakness – like when a little abstraction could come in handy.

Read more »

Generic Linear Search – in C

Linear search is the simplest search algorithm – as simple as getting pulled over by the cops in front of a donut shop. One advantage of this algorithm is it uses simple data types and does not require the data to be sorted. It simply involves starting at the very beginning of an array and checking the value at each index against our key. This algorithm, however, is the slowest algorithm and is O(n). For randomly distributed data, the probability of finding the key would be n/2 (for large n).

Read more »

Determine if a Number is Prime – in C

Why do we care whether a number is prime or not? Prime numbers are the atoms of mathematics. Understanding primes enables evil bankers to securely send your financial records to their other banking industry friends. They let Uncle Sam and the NSA keep its interest in world domination secret, you know, the one world order that is inevitable. Even Euclid knew that understanding primes was pertinent for human survival. He proved that there were an infinite number of primes around 300 B.C. I guess he had nothing better to do. They didn’t have YouTube back then.

Read more »

Thanks to Jekyll, I'm Cheating on WordPress and it Feels Great

It’s OK. Don’t worry. I asked my Rabbi. Well, actually my friend’s Rabbi as I’m not Jewish. I text’d him wondering if this was a “sin.” Yeah, a Rabbi that has a smartphone and accepts text messages. He said to be quick as his wife was making him Matzah ball soup – his favorite. She has this thing where she adds a dab of curry to spice it up.

Read more »