Have you heard of Fizz Buzz? It’s commonly used as an basic software interview question or an intro programming example. It’s based on a game meant to teach children division and goes like this. The children sit in a circle and count up from one; but, if your number is divisible by 3 you say “Fizz” instead of your number and if your number is divisible by 5 you say “Buzz” instead of your number. If your number is divisible by both 3 and 5 you say “Fizz Buzz”.
Many of you are familiar with the Birthday Paradox. If you want to read more about it you can find a good article here. Basically, it says that in a room of 23 people, there is a 50% chance that at least two people share a birthday. And if you increase that number to 75 people, the chances go up to 99.9%. I wanted to explore this a little more and rather than doing the math (boring!), I decided to do a Monte Carlo simulation, run it a bunch of times, and plot the results.
Most of you can just skip right over this post since you don’t pay rent or live at an apartment that allows paying with a credit card. But if you’re in the lucky situation that I am, paying your rent with a credit card can be an easy way to get credit card points.
I’m working to bone up on my python skills so I decided to spend my Sunday doing problems 1-10 from Project Euler. I’ve done them before with C or Java but this was my first time with Python. Here are the problems and my commented code for each one in case it interests anybody.
Last week a podcast I listen to, the 404, discussed a math problem where you roll six 20-sided die and count how often you get a situation where at least one dice matches another dice. They discussed the math a little and came to the conclusion that it happens far more than you’d think. I thought it’d make a good monte carlo programming exercise so I’ve done just that. Below, you’ll find my C code (though it’s not great) and results for 2-20 dice.
I recently outgrew my old watch case and decided to get a new one. I had trouble finding ones I liked and that would use the space I had efficiently, so I decided to make my own. Now, let me start by saying that this isn’t perfect. At all. Not even close. And I’ll admit that it’s kinda driving me crazy. But the goal here was to be quick and cheap since I’ll probably only be using this for a year before moving into a new home and making a new one. Details and pictures after the jump.
Here’s a short little post to show something I made a few years ago. It’s a simple, tiny board with a couple of resistors that is used to measure the input voltage. It uses a simple voltage divider to reduce the voltage from the raw input pin and allow the conveniently close analog pin to read it.