Monthly Archives: October 2013

Solomon Wisdom Probability Problem

I saw this problem in a Probability course offered by the Harvard Extension program. I highly recommend it if you have the time. Here’s the problem: In Solomon’s reign there were two types of prophets: true prophets, who spoke the truth 9 out of 10 times, and false prophets, who only spoke the truth 5 […]

Solution to Problem 28 on Project Euler

The problem: Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21 22 23 24 25 20  7  8  9 10 19  6  1  2 11 18  5  4  3 12 17 16 15 14 13 It can be verified that the sum of the numbers on the diagonals is […]

The Prosecutor’s Fallacy

Before I explain what the prosecutor’s fallacy is, here’s a real life example where it affected (for the worse) the life of someone. Sally Clark was a British solicitor, and in 1996 his first son died, only weeks after his birth. In 1998 the same pattern occurred, when his second son died only weeks after […]

Bayes’ Theorem with Examples

Thomas Bayes was an English minister and mathematician, and he became famous after his death when a colleague published his solution to the “inverse probability” problem. Described below. Given that you have a urn with 10 black balls and 20 white ones, what’s the probability that by picking randomly you’ll get a white ball? This […]

How To Make A POST Request with PHP and cURL

Below you’ll find the PHP code to make a simple POST request using cURL. You can send the POST request either to your own server/domain, or to an external one, though it’s not guaranteed the external host will accept your POST. <?php                 $name = "John Doe";                 $email = "";                 $url = "";                 $fields = "name=$name&email=$email"; […]

Solution to Problem 26 on Project Euler

The problem: A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: 1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(142857) 1/8 = 0.125 1/9 = 0.(1) 1/10 = 0.1 Where 0.1(6) means 0.166666…, […]

Introduction to Probability

First things first: what is probability? Probability is a measure or estimate of how likely a certain event is to happen. Another way to put it: how likely a statement is to be true. Probability theory is the branch of mathematics concerned with these measurements and estimations. It’s a relatively new branch (when compared to […]

The Birthday Problem and Paradox

The classic birthday problem goes like this: there are N students in a classroom. What’s the probability that at least 2 of them will share the same birthday? Consider that a year has 365 days, and that a person has an equal chance of being born on each day. Let’s say N = 23 (you’ll […]

C Program To Investigate Memory Sections

The program below illustrates functions and methods you can use to investigate the allocated (virtual) memory of your process. For instance, you can get and print the limit of your data section, guess the limit of your stack and so on. One curious thing you’ll notice is that small mallocs appear to allocate memory inside […]