Kaprekar’s constant

A student talked about Kaprekar’s constant (6174) during their my favorite presentation.
Really cool.

Steps (from wikipedia):

  1. Take any four-digit number, using at least two different digits. (Leading zeros are allowed.)
  2. Arrange the digits in descending and then in ascending order to get two four-digit numbers, adding leading zeros if necessary.
  3. Subtract the smaller number from the bigger number.
  4. Go back to step 2.

Here’s an example (also from wikipedia):

For example, choose 3524:

5432 – 2345 = 3087
8730 – 0378 = 8352
8532 – 2358 = 6174

Fun right? Also fun to program, here’s the python code that tries every number from 1000 to 10000, and counts how many steps it takes to get to 6174 and puts the results in a csv file:

def largest(nstr):
    if (len(nstr) == 0):
        return ""
    elif (len(nstr)==4) and (nstr[0] == nstr[1] == nstr[2] == nstr[3]):
        return "7641"
    digit = -1
    index = 0
    for i in range(0,len(nstr)):
        if (digit < int(nstr[i])):
            digit = int(nstr[i])
            index = i
    return str(digit) + largest(nstr[0:index]+nstr[index+1:len(nstr)])
def kaprekarSteps(n):
    count = 0
    nstr = str(n)
    while (n != 6174):
        l = int(largest(str(nstr)))
        lstring = str(l)
        s = int(lstring[::-1])
        n = l - s
        nstr = str(n)
        while (len(nstr) < 4):
            nstr = "0" + nstr
        count += 1
    return count
f = open('kaprekar.csv','w')
c = 1000
while (c < 10000):
    f.write(str(c)+ "," + str(kaprekarSteps(c)) + "\n")
    c += 1


Euclid GCD

I saw this toot by Matt yesterday morning and I loved the visual of the color based on the number of steps of Euclid’s GCD algorithm. The algorithm is pretty straightforward and it’s a nice example for either using recursion or using a loop. The coloring is fun to mess with too. The coding went quickly for me because I already had the code for breaking a 1D pixel array (why processing??) into x and y coordinates.
There’s two variations:
Here’s the link for the GCD steps version.
And here’s the link for the GCD version where the closer the GCD is to the minimum of x and y, the more white the pixel is.
Here’s the recursive algorithm:

int euclidGCD(int x, int y)
  if (y == 0)
    return x;
  else if (x >= y && y > 0)
    return euclidGCD(y,(x%y));
    return euclidGCD(y,x);

Here’s the loop algorithm to count the number of steps:

int euclidGCDsteps(int x, int y)
  int t;
  int steps = 0;
  if (x >= y)
    while (y != 0)
      t = y;
      y = x % y;
      x += t;
    return euclidGCDsteps(y,x);
  return steps; 

My Favorite for the Students

Let me know if these are things that interest you as a teacher of children:

  • You want the students to find your subject interesting.
  • You want the students to investigate your subject in their own time, like an adult would do.
  • You want the students to continue to develop their presentation skills.
  • You want the students to pique the interest of the other students in the class in your subject.
  • You want to expose the students in your class to a diverse set of ideas, opinions, and experiences.

When I (briefly) attended Twitter Math Camp last year, I really enjoyed the My Favorite section of the conference. This is a section where teachers came forward and presented something that they liked that they thought the other teachers would be interested in. These included activities, strategies, etc. Pretty much whatever the presenter thought the other teachers would enjoy. They had about 5-10 minutes to present.

To co-opt this My Favorite structure to my classroom, I asked every student in all of my classes to present one thing that they found interesting about math.

Here’s the document that I gave the students:

How’d it go?

Great! I loved it, and I (think) the kids loved it. We had so many different and interesting topics. Here’s a quick subset of the topics that were covered in three of the classes:

Fibonacci and Bartok
Friendship Paradox
Volleyball winning odds
Pi Cupcakes
Vortex Math
Birthday Paradox
Chaos Theory
Hairy Ball Theorem
3D Polyhedra
Pythagorean Thm
Riot Theory
Monty Hall Paradox
Pappus of Alexandria Thm
Golf Handicap
Quad Midpoints make Parallelogram
Kaprekar’s Constant
Number Trick
4 color theorem
Diving Scoring
Brouwers fixed point theorem
P vs NP
Mole Train Woot Woot
Sound and Sine
Fourier Transforms
Golden Ratio
Font Layout and Yearbook
Binary Numbers
Fermat’s Last Theorem
Rule of 72
Mobius Strip
P vs NP
Golden Ratio and Phi
Mandelbrot Fractal
Reuleaux Polygons
Graham’s Number
Pascal’s Triangle
Schwarz lantern
Monty Hall
Math (and Physics) of Bowling
What’s faster, going up or going down?

Only recognize about 2/3rds of them? Me too. It was awesome seeing the different mathematics that was discussed in our classes. What was the percent of topics that lined up with any of the final exams? I’d say under 5%.

Do you have 2-5 min to spare 30 or so times per class per year with very little burden of prep on the teacher? I would bet that you do.

Lizard Grow

My son was given this lizard as a big brother gift (can’t find online link to product, but here’s a similar toy).

Original Size


Size After 2 Day Soak


Before Measurements

Left image
Length: 905 pixels
Width (between front feet): 275 pixels
1 inch: 90 pixels
Right image
Height: 150 pixels
1 inch: 115 pixels

After Measurements

Left image
Length: 1014 pixels
Width (between front feet): 292 pixels
1 inch: 60 pixels
Right image
Height: 200 pixels
1 inch: 98 pixels


Original Length: 10.06″
Original Width: 3.06″
Original Height: 1.30″

After Length: 16.90″ (increase of 68%)
After Width: 4.87″ (increase of 59%)
After Height: 2.04″ (increase of 57%)



Calculations Take 2

Volume of box that would just contain original lizard: 10.06 * 3.06 * 1.30 = 40.02 cubic inches
Volume of box that would just contain soaked lizard: 16.90 * 4.87 * 2.04 = 167.90 cubic inches (increase of 319%)

Conclusion Take 2

Thoughts? Did I mess up?

More Questions

  • How big would it be if the volume *did* increase by 600%?
  • How big would the lizard be if it grew 1000%? 10,000%?
  • How big would the lizard have grown if it just barely fit in *your* classroom?

M&M’s Mega


3x the Chocolate?

What a great Calculus activity (hint: rotational volumes).
Cross sections with an exacto:



M&M Mega


What shape fits best? Click on image to get directly to the desmos interactive.
Pretty good fit.
Here’s the data for each type. I used a caliper to measure the dimensions.

To account for the candy shell you can measure pixels in an image manipulation program. If you’d like to follow along at home, the M&M Mega has a thickness of 404 pixels, and the chocolate only (no shell) has a thickness of 333 pixels. The regular M&M has a thickness of 251 pixels, and a chocolate thickness of 210 pixels.

You have enough information to do some damage, go ahead and see if the M&M’s Mega truly have 3x the chocolate of the regular M&M’s.


M&M Mega volume of 1,423 mm^3.
Regular M&M volume of 474.8 mm^3.

Fun. Great activity for calculus.
Phew, no fox news.

Daily Desmos 3.0

Hello all, we’re looking to reinvigorate the Daily Desmos project and we’re looking for new contributors (and that means you!). We’re taking away the schedule and the numbering system so you can submit posts directly to DD whenever you’d like. You can still submit images via email, but we’re going to increase the number of authors on the website and we’d like your help! Would you like to sign up? The only responsibility that you have is to post a Desmos image whenever you’d like. Yep that’s it! Interested? Comment on this post, contact me on twitter, or email me at my email address. Thanks!

Feedback On My Feedback System

In response to the Dark Lord Pershauron, I’ve decided to see what feedback you all have for my current SBG setup (v 5.0).
The course is Pre-Calculus honors. There are about 40ish standards for the year. About once a week students take a test on several standards (2-4). The first time they see the standard there is no grade; this is an opportunity for the students to see where they are. I started off giving them feedback but moved to self-feedback only: when finished, they go to a feedback station (@fnoschese style), grab a colored pen, look at the key and give themselves feedback. Sometimes they work in their groups to get the feedback and I put the key up on edmodo (all the keys end up on edmodo). They keep these feedback quizzes and put them in their folder.

The second time they see a standard it is for a grade, normally a week or two after we’ve taught the topic in class (grade out of 5: 5, 4.5, 4, 3, or 2). The grade goes in the books as is. They get three reassessment opportunities per term (out of 10-15 total standards per term). They see their graded quiz, but they don’t get to keep the graded assessment.
Things I need to get better at for next year:
Providing feedback myself to the student instead of just leaving it up to them. I like they they take responsibility in knowing what they know and don’t know, but I don’t think they are always able to give themselves the directed feedback that a teacher could give. I get a general idea of where the class is by informally going around and looking at quizzes post feedback, but I don’t have the whole picture. This informal feedback has changed the class, sometimes its obvious that they’ve understood a topic and we can move on, other times it’s clear that we need to take a different look at this material before moving on.

Thoughts? Comments? Let me have it. I see this as shot peening for my grading system. Thanks in advance!

Money Duck

This is a crosspost from my 180 photo blog.


If you haven’t read Dan Meyer’s take on the Money Duck, go ahead and read up.

Here’s some classroom action:

Act 1

I presented the Money Duck to my PreCalculus H classes. We were in the midst of probability and we were moving towards probability distributions and expected value. This activity popped up at just the right time to (quickly) try it out. So without any lead in to the activity, I showed the picture of the money duck:
Then showed the video that Dan made:

After the video I overheard quotes like

Student Alpha: That’s really annoying that they didn’t show the price.

So the pump was nicely primed.

Questions 1 and 2

I gave out Dan’s handout and each group of 2/3 worked through it independently and I went around and poked and prodded with questions.
Here are some quotes from the first two questions:

Question 2:

B can’t be possible because they add up to more than 100%.

(some groups got confused about the question… they were trying to figure out which distribution was the same as the ducks from the video)
Student Beta: C is the one from the video.
Student Gamma: D is also possible from the video.

Question 3


Student Delta: I feel like A would be bad because no one would keep buying ducks.

Student Epsilon: But B would be bad because you’d be losing money.

Question 4

The students had an easy time sorting out the most and least likely to buy for $5 (by eyeing it), but a difficult time sorting out the two middle positions. I’d say the groups were evenly split at the guesstimate for sorting the middle two. I went around to each group and asked how they sorted, and mentioned that it’d be nice if there was some way to formalize the guesses.

Questions 5 and 6

About half the groups got calculating right away without giving a gut guess (on question 5). I didn’t help out with question 6 unless asked, just put the expected value formula up on the board. Most groups figured it out on their own.


When groups finished up, I put them in the position of the producers. Asked them to come up with:

  • Group Name (this might have been a mistake, took many groups a LONG time to pick a clever name)
  • A probability distribution
  • A price for the soap

When they came up with those three things they either entered in the information at my teacher computer, or on my chromebook.
Screen Shot 2014-05-11 at 2.42.05 PM
When they were finished with entering in the information I asked them to step away from their companies goal, and become individual buyers of the soap. Which would they buy… and why?
These students quickly found out that they had to do a bunch more calculations of expected value, and they were becoming bored with this calculation. Thankfully spreadsheets are both fast and accurate at calculations, so I put in the required formulas and calculated the expected values…
Screen Shot 2014-05-11 at 2.42.29 PM
Screen Shot 2014-05-11 at 2.42.36 PM
Interestingly a couple of groups either went down the route of a non-profit (but not really) corporation, or they didn’t understand how to properly set a price for their soap.
Nice activity, a nice extension might be to go from the theoretical to the empirical world by actually “making” the ducks, and seeing how the gambling buying of the soap actually turns out.

Edward Frenkel on Math and Beauty

Edward Frenkel, author of Love and Math, was on The Colbert Report.
Here’s a transcript of an especially interesting segment:

Edward Frenkel: When you say that you hate math, you’re really saying I hate the way math was taught to me. Imagine you’re in art class in which they only teach you how to paint a fence or a walk but they never show you the paintings of the great masters. Then of course years later you’re going to say “I hate Art”, what you’ll really be saying is “I hate painting the fence.” And so it is with math. When people say “I hate math”, what they’re really saying is “I hate painting the fence.”

Stephen Colbert: But in math, don’t I have to know a fair amount of the high end math to appreciate the work of the masters? It’s almost as if you can show me the painting of the masters, but I don’t have eyeballs yet. Don’t you have to grow the math eyeballs to see the equations as beautiful?

Edward Frenkel: That’s our job. …