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

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

Bouncing balls python simulation

Linked from the Visualizing Math blog, a cool simulation of bouncing balls with randomized gravity and bouncing coefficients. Forward Slash Reality Check out the video too.

Fractal Brownian Tree

@fawnpnguyen whoa. Need to try and make this. — Dan Anderson (@dandersod) June 4, 2013 I started off and used VPython to create the fractal, but it was slow and buggy. Here’s a movie of my first attempt. When you click you create a new “seed” for the fractal to start.  So I rewrote it […]

Calculate Pi with Python

Intro to Computer programming worked at calculating digits of pi today. The actual algorithms aren’t too bad, but getting more than the standard number of digits from a double is a bit trickier. Here’s a program that calculates pi using: Bailey–Borwein–Plouffe formula Bellard’s formula and Chudnovsky algorithm Holy smokes is Chudnovsky algorithm’s fast! Plouff Bellard Chudnovsky Iteration […]

Reducing Prime

Number theory nugget: 357686312646216567629137 is a prime number which remains prime after removing any number of digits from the left side! — Maths World UK (@MathsWorldUK) March 4, 2013 Otherwise known as left-truncating primes with every suffix prime and no digit are zero. Here is the whole sequence. It was proven that 357686312646216567629137 is the last […]

Google Blockly

From @joshgiesbrecht , fantastic web app from Google. Blockly is a web-based programming environment that allows you to export the code as Python, Javascript, Dart (anyone outside of google use this??), or XML (wow ugly code). Blockly was just released a couple of days ago so it’s still rough around the edges, but has a nice […]