How do I start Programming?

These excerpts are from a response to a reader on the wonderful tumblr by Jerome Herr, Experiments In Processing. Learning to code is like learning a natural language: it’s quite hard and slow at first but if you hold on just a little then suddenly you start seeing all the beauty of it and you’re […]

Kaprekar’s constant

A student talked about Kaprekar’s constant (6174) during their my favorite presentation. Really cool. Steps (from wikipedia): Take any four-digit number, using at least two different digits. (Leading zeros are allowed.) Arrange the digits in descending and then in ascending order to get two four-digit numbers, adding leading zeros if necessary. Subtract the smaller number […]

Mandelbrot Fractal v2

I had so much fun with the original Mandelbrot program that I decided to see if I could improve it. I was amazed by how easily I was able to generate a fractal picture that looked exactly like other pictures online. I didn’t look at anyone else’s code, just went down the path and the amazing […]

Mandelbrot Fractal

I was inspired by a My Favorite presentation from a student on the Mandelbrot fractal. I played around for a half hour at school without a ton of success, but I sorted out the sticking points on the way home, and finished it up tonight. Amazingly simple (the code may not look simple, but it’s […]

Chaos Game v2

I prepared a small demonstration of the Chaos game for some math teachers. First we used transparencies, markers, dice, and rulers, but humans are mistake-prone and slow. To The Computer! I decided to experiment with the rules of the game to see where it’d go. Human Error What happens when you bring in a random amount […]

Buffon’s Needles simulation in Processing

Buffon’s Needle is a famous way to (slowly) estimate . Here’s a processing.org program to calculate (to keep the math-hipster hatred of -day at a critical point and concave up). Link to live simulation and code. All variables are easy to change, size of window, length of needle, spacing of lines, etc. Neat program to write. […]

Two James Tanton Questions

It’s midterm week at school, and James Tanton threw out two interesting questions in two days. I spent a little time programming “solutions” to these problems (not solutions, just verifications for an infinitesimally small portion of the natural numbers). Problem One: Start with a prime, square it, and add 4. Repeat. (eg 3->13->173->…) Must eventually […]