# 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.

# 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

# 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.

# 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.

# 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.

# 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).