Rule 30 RNG

Today we get away from the word games for a little while and get back to talking about random number generators (previous posts here and here). Or rather one random number generator in specific: a Rule 30 psuedo-random number generator (PRNG). (Here’s the motivating post from Programming Praxis.)

Remember the previous post I made about cellular automaton? The basic idea is to turn those into a random number generator. If you go back to the linked post in particular and give it Rule 30 with a random initial state, you can see how chaotic the rows seem to be. Perfect for a PRNG.

read more...


Line art with an HTML5 canvas

Let’s play with HTML5 canvas elements!

Basically, I want to draw some simple line diagrams. Go from top to bottom on one side while going from right to left along the top or bottom. It sounds complicated, but perhaps it’s easier to explain with a drawing:

read more...


n-queens in 18 lines of code

One of the rites of passage for computer scientists it seems is to solve the Eight Queens Problem–where you must place 8 queens on a chessboard so that no pair of queens is attacking each other. Even better is when you can expand that to the n-queens problem with n queens on an n by n chessboard. After finding it again in older posts on both Programming Praxis and DataGenetics, I decided to go ahead and take a crack at it and I think the solution is pretty straight forward.

read more...


A piece of the abc conjecture

There’s been a bit of hubbub in the in the math world the last few weeks with Shinichi Mochizuki's 500 page proof that of the ABC conjecture. Basically, the conjecture states that given three positive coprime integers a, b, and c such that a + b = c, the product of the distinct prime factors of a, b, and c is rarely much smaller than c. While this may sound strange, there are a number of interesting consequences that you can read about here.

To make a long story shorter, there was a challenge on Programming Praxis that intrigued me, which was to write code that given a upper bound on c would generate a list of all of the triples (a, b, c) such that the product is larger.

read more...


Who wants to win the lottery?

So everyone would love to win the lottery right? Just think of what you could do if you had even $1 million dollars to spend. You could buy a dozen tacos a day at Taco Bell for the rest of your life. And your children’s lives. And their children’s lives. 228 years to be more precise. Or you could pay to send the entire family from Cheaper by the Dozen to the average state university–even if they each took an additional two years to graduate. And that’s just for $1 million. Payouts are usually much higher than that…

So what’s the catch?

(If you came here just for the Powerball simulation, it’s down at the bottom of the page. Click here to go straight there.)

read more...