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 […]

CodeChef: Find Area of Triangles

The problem : Lira is a little girl form Bytenicut, a small and cozy village located in the country of Byteland. As the village is located on a somewhat hidden and isolated area, little Lira is a bit lonely and she needs to invent new games that she can play for herself. However, Lira is […]

CodeChef June Contest: Finding Squares

Our Chef is catering for a big corporate office party and is busy preparing different mouth watering dishes. The host has insisted that he serves his delicious cupcakes for dessert. On the day of the party, the Chef was over-seeing all the food arrangements as well, ensuring that every item was in its designated position. […]

Dining Philosophers Concurrency Problem in Java

Dining Philosophers is a problem about concurrent programming and synchronization, first proposed in 1965 by Dijkstra. Basically you have X philosophers sitting around a table, and there are X forks available (one between each philosopher). The philosophers do two things: think and eat (alternating between both). However, in order to eat the philosopher must grab […]

Chronological Order of Popular Programming Languages

Below you’ll find a chronological order of some popular and/or important programming languages. 1840 – Analytical Engine Code The Analytical Engine was a theoretical (i.e., never built) mechanical general-purpose computer, created by British mathematician Charles Babbage. Ada Lovelace came across the idea, and created some code for the Analytical Engine. That’s why she’s considered the […]