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

# python

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.

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

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

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

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

To introduce the fibonacci sequence using the recursive series to my Pre-Calc H class (although most of them know it), I came up with something on the fly that worked nicely. To set up the fibonacci sequence, I showed them a recursive program that calcuates the sequence in a very clear (but inefficient) way. This […]

Much like the Collatz conjecture, the Dr. Square Puzzle (from the blog mathforlove) is an intriguing problem. With some playing around, we came up with what I think is an excellent (and solvable) puzzle. He dubbed it the Dr Square puzzle, because it involves one of the steps in taking the digital root (dr) and squaring numbers. Here’s how it goes. […]

From Car Talk. RAY: This puzzler is from my “ceiling light” series. Imagine, if you will, that you have a long, long corridor that stretches out as far as the eye can see. In that corridor, attached to the ceiling are lights that are operated with a pull cord. There are gazillions of them, as far […]

Coolest thing I’ve seen in a while: High Resolution Mandelbrot code in Python. The following Python script, on the other hand, begins as ASCII art: It renders the Mandelbrot set as a full-color, anti-aliased, 1500×1000 image. Fantastic. Notice that the code also looks likes the mandelbrot set. A true accomplishment with python being so fussy […]