The Algorithm in the Code: Building an Inquiry Tool

A couple of days ago, I posted a Math Challenge posed by David Wees some weeks ago. The code emulated Euclid’s Algorithm of Coprimes and GCFs.



First analysis

Analysis of the code reveals that, when a=0, b=b and, when b=0, a=a. However, a reaches zero at the code’s onset, while b does the same after the code runs through scenarios when b≠0. This implies that one of the two values reaching zero is key to the code and the quantity of the other value when this happens is informative.

Tabulating the difference between possible values of a and b within an arbitrary range of integers might illustrate how b=0 is reached. This process falls in the Planning and Implementation steps of David Coffey’s thinking-stage charts. Here is my table for mapping the “moves” of the code within the range of -9<a<9 and -9<b<9.



Playing with b≠0

Notice that a>b below the a=b or 0 diagonal. So, for instance, the difference between a=6 and b=4 is 2, found in the bottom-left triangle of the table. In this triangle, according to the code, the difference a-b equals a. So, now a=2 and b=4.

Repeating the process using a=2 and b=4 produces a difference of 2, this time in the top-right triangle. The new difference b-a equals b. Now a=2 and b=2, which produces a difference b-a of 0. Since b-a = b, the code ends with b=0 and a=2.




There are six distinct cases where the code returns unique case results.

Case 1: a = b

When a=b, the code returns their common value. Why? As shown in the example above, the step after a=b is b=0 and the value of a is returned. This value is that when a=b.

Case 2: either a = 0 or b = 0

A starting value of a=0 returns b. A value of b=0, returns a. This is a rule built into the code. But what would happen if the rule were not followed?

Let’s take our b=0 and a=2 example beyond termination. Continuing the while-loop produces a difference a-b of 2, in the bottom-right triangle. This difference returns a=2 and b=0, exactly where we started.

What if a=0 and b=2? The difference b-a returns b=2 and a=0, another recursive repeat.

So, a=0 returns b and b=0 returns a. If a=b=0, zero is returned (in agreement with Case 1).

Case 3: a < 0, b < 0 or both < 0

When either a or b or both are negative, the code never resolves to termination (except when a=b, Case 4). In fact, the greater value iterates to infinity in steps of the lesser negative value.

Let us try a=3 and b=-2 (we could easily have tried a=-2 and b=3). The difference a-b returns a=5 and b=-2, which in turn returns a=7 and b=-2, then a=9 and b=-2, ad infinitum.

a=-3 and b=-2, on the other hand, returns (a=-3,b=1), (a=-3,b=4), (a=-3,b=7), again ad infinitum.



Case 4: a = b < 0

Contrary to Case 3, when a=b<0, the common value of a and b is returned, in agreement with Case 1. Ignoring this, Case 3 is followed; however, there is no condition that rectifies the ambiguity of which direction, toward infinite a or infinite b, the map should follow.

Case 5: +a and +b share a common factor

When a and b share a set of common factors, the greatest of these factors is returned, as per the a=6 and b=4 example which returned 2, the greatest common factor of 6 and 4.

Case 6: +a and +b are coprime, or relatively prime

When a and b do not share a common factor, 1 is returned, since 1 is the only natural number that is a divisor of both.

Let’s map a=3 and b=8. As you can see from the table below, 1 is returned.



The analysis of cases weaves over and through David Coffey’s thinking-stage charts’ Analysis through Verification stages.

Interpretation and Pedagogy

I was introduced to the formal Extended Euclid’s Algorithm via induction within a discrete mathematics university course. It was taught to me as a means to learn modular mathematics, so not much emphasis was placed on explaining the Extended Algorithm nor the induction. In fact, given this challenge posed by David Wees, or perhaps more so the table derived from it, the manner in which I learned the Extended Algorithm was probably the worst possible.

David’s challenge and the table offer great entry tasks into the study of GFCs, coprimes, Euclid’s Algorithm and several branches of mathematics that build from them. Before the Algorithm is even named and formalized, students get to explore its mechanisms and formalize their own rules based on their mapping activities. Once they master the code and table, they can learn the corresponding Algorithm schema with emphasis on matching the items of the schema to the mapping on the table and the methods in the code. Then the Algorithm can be named and its uses illustrated.

For those students who do not know code, the teacher can interpret the code with them and offer scaffolding afterward. The code is probably easier to understand than an instruction list, if instead of treating it as code, the teacher treats it as an outline of process. Notice the subtle difference here between instruction (do this) and process (this is how this works).

The table doesn’t just determine GFCs and coprimes, it illustrates how greatest common factors and relatively prime, or coprime, numbers are calculated. It also illustrates why negative integers do not produce finite results, except where a=b, and why a=0 returns b and b=0 returns a.

One question that might remain is what the table and code return. In the case of positive integers, the returns are obviously GCFs or 1. Interpretation can determine whether the initial values are coprime or related by common factor. But what does the return of a when b=0 and the return of b when a=0 mean?

Quite simply the returns are the divisors of the numbers being analyzed. So, if one of those numbers is zero, it stands to reason that the other number is a viable divisor of zero. For instance, when b=0 and a=3, the return of 3 signifies that zero is divisible by three. Arithmetically, when a=b=0, infinity or undefinable should be returned, since conventionally no number “can” be divided by zero. This is the one flaw in this code and table.

In order for the constructed table to be a viable tool for learning Euclid’s Algorithm, it should be printed out or created with non-erasable ink and the mapping should be done with pencil and eraser. The table can be used several times then to build literacy, mastery and fluency of Euclid’s Algorithm.

Do you have any tasks that engage students in active learning of the outcomes, content, skills and concepts you are teaching?

Emulating Evolution by Involving Students

Evolution is one of those topics I really enjoy learning and teaching, particularly with open activities. The War of the Evolutionists Web Scavenger Hunt and Mock Trial, and the Evolution and Adaptation games are just some of my attempts to engage students in ecology and evolution.

Of these The Evolution Game, created by Simon Boswell and Phil Lewis, comes the closest to emulating the process and product of evolution. The rules and gates of the game are the processes of ecology and evolution; it is not a trivia game, a passive one, nor one like charades whose play has little semblance to evolution. As such The Evolution Game exemplifies that rare and powerful quality game that embeds students in their learning by forcing them to deal with and adapt to the “rules” or processes of evolution and ecology. It is however a long-term activity, like Risk, of both strategy and chance.



Just yesterday, I came across another great activity that comes close to emulating both ecology and evolution. The activity, created by Tyler Rhodes and featured by Scientific American, consists of two parts: a student-centered exercise and a technical exercise. The student exercise takes about an hour, or one period, to conduct. The technical one — creating a video — took Tyler, who claims to be expert enough to work efficiently, three months to complete. So feedback in the form of product is delayed, though formative feedback is immediate and embedded in the students’ own activity.

The idea is simple, if not elegant, and follows the same design premise as The Evolution Game and Bernie Dodge’s formula for game design that “Elegance = congruity between the forms of the game and structures within the content“.

Tyler drew a nondescript salamander-like creature and enlisted five independent groups of students (from five schools) to draw copies of this creature.



Once the students compared and discussed the new creatures, Tyler “exposed” the creatures to some ecological stress or change. The students had to vote which creatures perished based on the new ecology and the features of the creatures. According to Tyler, ninety-eight percent of the creatures perished (in a class of 30, where each student drew one creature, one creature survived). Tyler gathered the extinct creatures and repeated the exercise five more times with the survivors, each time with a new ecological event wiping out ninety-eight percent of the creatures. The six generations were kept or labelled apart.

The exercise illustrated branching phylogenetic evolution and coevolution — rather than the defunct linear evolution — as shown in the following drawing, where each “arm” of creatures came from a separate class of students, so giving five arms.


A Wheel of LifeA Wheel of Life © 2012 Tyler Rhodes | more info (via: Tyler Rhodes)
Click on the image to enlarge it.


What is nice about this exercise is that the students actively engage in, and embed themselves in, the process of natural selection by ecological change. They, being the active agents in both the creation and voting off of these creatures, were given the opportunity to experience and learn about the fundamental processes of evolution, much like The Evolution Game.

Tyler designed this process after a “Chinese Whisper” or “Telephone” game, where a message is passed from person to person and changes through mutation as it is delivered. In fact he presented it as a game. The message, however, was visual — the drawing of the creature — and the changing ecology affected the message. Tyler was specifically looking for a way to branch the creature evolution like a phylogenetic tree and his use of the “Chinese Whisper” or “Rumour” game enabled this.

Here is the final video.


The creatures in this video are those from the top-left arm of the Wheel of Life tree illustrated above. Tyler promises four more videos, for each of the remaining four groups of students. And he invites teachers to take his initial nondescript salamander-like creature, repeat his method and e-mail him facsimiles of the creatures created. If teachers take him up on the offer, he can bank, analyze and share some really interesting evolutionary results from the project. His conclusions should be interesting.

For more information on Tyler’s project, visit his blog, Evolution!, documenting his progress.

How can we emulate Tyler’s project for outcomes in our classrooms? Or have you done so already?

Our Children’s Gears: Do You Like Dinosaurs?

Do you like dinosaurs?

Or did you when you were a kid?



Dinosaurs are neat. They are big, ferocious and were, quite frankly, very successful. They were also the dominant animals of the Mesozoic, for 180 million years. That is impressive.


I never liked dinosaurs when I was a kid. I found them boring.

I was beguiled by the Palaeozoic and early Cenozoic rather than the Mesozoic. The creatures — plants and animals — that lived then were alien, intriguing and awesome.

I could never put my finger on why trilobites and Paraceratherium interested me more than dinosaurs. But there was a pattern in that interest that cropped up elsewhere in my life.

An underlying ecology

When it came time for me to enter university, I knew exactly what I wanted to be — an ecologist. Not a botanist, not a zoologist, not even a geologist, an ecologist. Don’t get me wrong, I was fascinated in zoology, botany and geology, mostly botany, but I did not want to study one thing.

I was interested in it all. I was interested in how it all fit and worked together. I was interested in how life lived on an erratic Earth. Its individual forms fascinate, but mostly as pieces of the intricate whole.

And that, as I later found out, was why I didn’t like dinosaurs. They ate. They fought. They terrorized the land — not to mention other animals. But, until the last ten to twenty years, for me they never belonged — neither fit nor worked — within a bigger system.

They were boring.

In the last decade or two, that changed, or perhaps I became aware of the “bigger” Mesozoic picture. More Mesozoic palaeoecology has been learned and integrated into other disciplines, as illustrated in Harold Levin‘s The Earth Through Time (I have the 2003 seventh edition published by John Wiley and Sons). And now the dinosaurs belong with, influence and are influenced by a bigger lifescape and ecology. Dinosaurs became more and more interesting as they began to fit and work in the puzzle of life and living in a changing, furious Earth.



It is their place in ecology that fascinates me, not their ferociousness nor their reputation.

The point? Even as a child, I was geared toward ecology.

An overarching Universe



My enjoyment of astronomy also stems from the same root. I am fascinated by the Earth’s place and development in the Solar System, and of the Solar System’s place and development in the Universe.

I look at a star as I do a handful of sand and I wonder about its past, about its surroundings, its environment, its present and its future. I wonder about what it interacted — or will interact — with, what it influences or what it is influenced by. I similarly wonder (to the same depth) about the Universe that the star represents and the Earth and rock that the sand typifies.

I remember encountering an ant crawling on a moss and seeing its ecology and the ecology of the ecosystem where it lived. I had no words for these concepts, but I distinctly remember seeing the ant interacting with its environment. I barely noticed the ant outside of this frame. I was in grade two. And I still see ants and stars and handfuls of sand this way.



A far-sweeping magic

Story exists in this way too. With story we build our cultures, societies, histories, skills and technologies. But we also build our spirit and curiosity.

Story exists in a bigger context, constructed of reality and imagination and wonder.

Arthur C. Clarke coined, “Any sufficiently advanced technology is indistinguishable from magic”. I prefer to replace “advanced” with “exotic”, meaning unfamiliar or novel or not (currently) understood.

Ants and sand and stars, ecology and math and story and language are magic. There is always more of them to explore.

Story is a form of species-changing magic. And writing transmits this magic into the minds of generations and far-flung peoples.

In writing fantasy (which I mostly do), one creates the rules of a given world and studies how a story fits and works within that world. It is intriguing to witness story unfold even as one writes it. I am always surprised by what story reveals, about what it says about the world it explores, influences, interacts with and is influenced by.



Story is a key part of my life and has been for as long as I can remember. I am geared toward it like I am ecology and astronomy.

The gears of our children

In his essay forward, The Gears of My Childhood, to his 1980 book Mindstorms: Children, Computers, and Powerful Ideas, Seymour Papert eloquently describes how gears shaped how he perceived the world and approached learning when he was a child.

We all have our gears where what we learn ceases to be flat and static and becomes multidimensional and living. Papert describes vividly how gears of different sizes fit together to produce meshing products in a multiplication table. I tried to describe here how interactions are part of my guiding gears. I have students who are ranchers. Others are athletes, artists, scientists, writers. And of course they are each interested in more than one thing and are geared toward truly fundamental world views.



Imagine viewing multiplication as representation of meshing gears. What most affects us, influences our world view and shapes how we perceive and interpret what we later encounter has a great effect and affect on what we learn and how we do it.

Teaching toward our children’s gears might help them understand and learn what we are teaching. It also might allow them to more easily own what they learn, extend it beyond our teaching and keep it for a lifetime. Teaching the student more than the students and the lesson content facilitates her engagement with and conceptualization of the outcomes we wish him to learn.

Papert recounts his discovery that others do not share his world model of the gears, but have different models instead. We have to teach students we know in multiple ways to help them learn what we want them to learn. We have to know and value our students to help them realize their influence, their potential and their dreams.

We might have a class under our charge, but that class consists of unique individuals geared by unique world models. The function and art of teaching is to change behaviour not people. Our gears are as precious as our names. Sometimes all we own are these two things. We need to be careful to nurture and engage our children’s gears so that they might serve our children well in our multi-layered societies.



This post was inspired by David Wees’ draft of a keynote he was invited to present at the 2012 University of Alberta Faculty of Education Technology Fair.

Revisiting the Solstice – A Year of Educational Blogging

Today marks the anniversary of my first two posts, Merry Eve of Winter Solstice in Stefras’ Bridge and Anthems & Apathy in Digital Substitute.

It is a good week to reflect on the blogging I did this year, the comments I made on other blogs and the impact I think these made on me as a person and a teacher. So for the next few posts, I plan to explore my blogging and my relationships with other bloggers.

And because what I blog often spills over into what I tweet, and vice versa, I will mention some tweets, chats and conversations I participated in over the past year that influenced or were influenced by my blogging.

I also worked on my Teaching Resources, Flickr, YouTube, Prezi (and) and Wiki sites this year. Much of the material on these sites cross into and out from my posts and tweets as well.

And, of course, I will explore the impact of these on my students’ learning, on my learning and on my teaching. I think I gained a lot.

This recognition of my first anniversary of blogging is cross-posted in my writing blog, Stefras’ Bridge.

One Year of Tweets

There are conversations that are so inciting that you are impelled by every muscle in your body to jump in and join. You join to learn more. You join to connect. You join to share and to contribute to the shape of the conversations.



Twitter can be absolutely anemic, devoid of any purpose or reason or even care for the presence of others.



But it can also be a maelstrom of issues and opinions, of arguments and discussions, of thoughts, of questions and suggestions, and of links and videos and images.

It can transform the very way you think and teach and learn. It can network you with colleagues and people of similar interest around the world. It can organize meetings both virtual and actual. It can rally movements and ideas. And it can make us better people.



How I began

One year ago last Friday I joined Twitter and tweeted my first tweet.

I don’t remember the content of that tweet. I lurked for about only ten minutes, then I leapt, eager to wet my feet, when a conversation that peaked my interest came along. My induction into Twitter began with conversation.

I joined Twitter because as a substitute teacher more than anything else I felt that I needed to relate more to my students. Since most of them spent much of their lives texting and instant messaging, I felt that social media was a good way to close at least some of the technological gap between my students and me.



Previously, I had been an ecologist. I spent most of my time outdoors, in a lab, in an office or in front of a university lab or classroom. Social media had not taken off yet. Internet Relay Chat, e-mails and websites existed, but Twitter, blogs, YouTube, Flickr, RSS and all the many many cloud and Web 2.0 applications were not yet developed or popular. Then came a twelve-year gap during which I dealt with severe health issues and I lost all connection with technology.

You can imagine my shock when I returned!

Building a PLN and developing professionally

Fortunately for me, George and Alec Couros offered a Using Social Media for Transformative Teaching & Learning webinar series at just the right time.

I was able to jump into social media with some support and guidance, so avoiding the shock many teachers who don’t get that support experience.



This is where Twitter surprised me. I joined expecting that anemic activity that most people not having sampled Twitter imagine. What I found could not be more opposite.

Twitter is professionally and personally empowering when used purposefully. It can help you:

  • connect, engage and network with like-minded people,
  • share what you know,
  • learn about professional and collaborative opportunities and resources,
  • learn from others, and
  • enhance your teaching, learning and thinking toolkits.

Its greatest benefit is building a personal learning network or community (PLN or PLC) and developing professionally (PD) with these colleagues. It is all about the networking and collaboration.

Teachers interconnect around the world to discuss issues, ask questions and help each other become better teachers.

When used correctly, it is an exemplar of professional development.



What I accomplished

But it doesn’t stop at tweets.

Along my journey this past year, I discovered uses of Twitter that further professional development and networking.

  • One of the first things I discovered were links in tweets to resources, courses, tools, and people who are experts in teaching and content areas.
  • I also discovered colleagues and experts who use Twitter through mentions, retweets, replies, and discussions.
  • From these I built a community of people I follow, most of whom are teachers, but many of whom are scientists, writers, artists, technology experts and other people of interest.
  • And in turn, as my tweets became more helpful to others, I gained followers.
  • I collaborated with many people on mutual or individual projects.
  • I accessed the perspectives and knowledge of colleagues through tweets, blogs, posts, comments, paper.lis, mashups, RSS feeds, Diigo or Delicious indices, images, videos, and media, all accessed through Twitter.
  • I built an identity, a brand or reputation, confidence in my relationships and opinions, and a staff — yes, it is a bit pompous to consider my PLC as a personal staff, but as a sub I lack one otherwise.
  • I welcomed those who are new to Twitter, paying forward what my PLN gives to me and looking forward to networking with new people.
  • I even connected with people who are just entertaining, such a Samuel Clemons, a ferret of all creatures who tweets just to entertain others. Such connections are important just to take a break.
  • And I developed a Twitter sense of humour that lightens some of my tweets.
  • I linked to formal professional development opportunities advertised in Twitter.
  • And I tweeted about myself and about beautiful things in the world to stretch beyond the professional and into a larger sphere.
  • But what I most value about Twitter are the impromptu and informal conversations and the formal and planned chats that I have participated in. Conversations and chats are where Twitter shines and professional development really happens. They are also what my students gain from texting and instant messaging. I regularly participate in #mathchat and, though I would like to do the same with #engchat, #scichat, #globio and #edchat, only occasionally participate in these.
  • I even informally hosted some sessions of #mathchat, suggested a few topics and just recently selected a popular one for discussion.



Small regrets

I encountered a few problems along my journey with Twitter.

  • I inadvertently insulted a few people for a short while, only later learning I had done so. This I suppose is a trap common to all social endeavours.
  • I stated things that were interpreted completely differently than I intended, only having to clarify my meaning with more than 140 characters.
  • I have even recently run into Twitter’s 2000 or 1.1% follower threshold, which I calculated I can never make up as more people I want to follow follow me. To this end, I have weeded out people I follow who no longer tweet, who do not fit into my matured PLN or who tweet only occasionally or in irritating chains or spurts. Such pruning is a hard lesson to learn.

Ending the year

I may not remember the content of my first tweet, but my final tweet of my first year on Twitter was short and sweet. I tweeted one simple word.


I did so in response to an unrelated context, but I think it encapsulates my experience this year with Twitter.

How I feel about this past year

Tweeting and lurking can be time-consuming. Let’s be honest. It takes time to build relationships, time to converse and chat, time to read or view or listen to others’ tweets and the resources they link to. Tweeting takes time. But any worthy professional development takes time. Any worthy professional development builds and grows. It gets richer, broader, deeper and more vital. But it takes time.

And it is time worth consuming.

In the end, it is our students who matter. In the end, all this tweeting and blogging and casting and photographing has to work with other things we do, including planning lessons and units, creating assignments, managing classes, assessing, coaching, caring, fretting and hoping, to help our students learn.

I have learned so much from my PLN that I am a better and more responsive teacher.

Would I recommend Twitter to other teachers?

You bet. Twitter rocks!



Math Begins With an Answer?

We all hear it; we all say it. Students want the answers; teachers want the learning. But now, it seems students might also begin with, and not just want, the answer, or maybe they ignore everything but the answer, despite our effort to encourage and facilitate learning.

I am in the middle of reading Nat Banting‘s post Measuring Roots. He makes one statement in this post that I wish to address (indeed, my response below is cross-posted as a comment on his post).

I found this statement so profound, I had to stop reading the post and respond to it.

Nat’s statement is here:

For students, no matter how young, math begins with an answer.

Here is my response:

I stopped reading this post as soon as I read the point that, for students, math begins with an answer. (Don’t worry, I plan to read the rest of the post. But I needed to respond to this; it is so mind-blowing.)

I learned under Dr. David Pimm of Open University (UK) and the University of Alberta (CAN) during my Diploma in Math Education studies. He argues that math begins with a question; in fact, it does not exist until a question is asked. All the demonstrating and lecturing about math in the world does not involve math until a mathematical question is asked.

This discrepancy is very revealing. It tells us what math is and what math education is. Most students learn to expect math questions and problems to be short, quick, to the point, solvable and structured around “clean” answers (often related in some way to integer components). They anticipate the answers before they anticipate the questions. I am not sure if they even consider the math, and if they consider the questions mathematical, or mathematically.

I wonder what they are really learning? Is it math? What to them is math? Is this why so many students are so disconnected with math and why they are proud to have failed it and ashamed to have aced it? After all, from their perspective, if answers they anticipate before math, what have they aced?

I think we have done students a great disservice if they ace math in elementary, secondary and even tertiary school without ever actually learning that math is all about the question, the quest and struggle to tackle it and the discovery of pattern that possibly limits to (an) answer(s). They completely miss the point and the empowering strength of math process and pattern. And in the end they really have nothing to use in their lives beyond the “math” lesson.

So, why do they need to learn this? That question makes so much sense now.

I shall now return to your post.

Further Reflection

It is easy to lose sight of our students’ understanding of what we teach. Sure, we anticipate their individual problems and our scaffolding of these problems. We tailor our lessons to help each student. We ask leading questions or offer leading hints to open the door for them to learn. But then we learn that they have a completely different fundamental take on what we are teaching (and how) and what they are learning (and how). Sometimes these takes are so fundamental in fact that we can not even conceive them, never mind address them.

And this is where professionally developing with our PLNs really helps us to grow, to learn, to better ourselves.

Sometimes what we think makes sense only makes sense because we think about it within a certain frame and from a certain premise. David Hewitt would consider this generated, rather than necessary, knowledge. Until the moment I read Nat’s statement, I thought that students shared the same fundamental sense I did; that is, I thought this sense was necessary and common. They might want the answer and to skip the learning, but they start learning when a question is considered and asked, regardless of who asks it and whether it is internal or external. Thinking, in short, starts with a question.

All it takes is one statement, simple to others, even the author, to change our view of what we are doing forever.

Are we teaching our kids that thinking starts with an answer? That an answer even always exists? Do our kids think backward from us — speculating an answer then working through, rather than on, the question and its “solution” until they match their guess or verify no match? Are we teaching them the wrong way, literally?

The way we teach (think) now, we solve problems. Do our students anticipate solutions and then test them, like a computer batch tests scenarios or a player navigates a game? These are very different ways of learning, teaching and thinking. Much skill and strategy is lost by exchanging deliberate problem consideration and solving or playing for rapid testing of many outcome and solution (scenario) possibilities. In a very real sense, problem solving is deductive, while answer testing is inductive. New skills and strategies are needed to solve problems this way. And new methods of teaching need to be added to our portfolios and lessons.

What do you think? Do students start learning by considering an answer or a question first? Are we teaching them the “right” way? Should we teach both directions, or are their still more directions, more senses, we need to consider?

Any thoughts on Nat’s claim and its implications?

I am seriously considering that there is some truth in his statement. Perhaps kids approach learning inductively and deductively. Perhaps some kids approach learning one way under certain circumstances, the other under others, and different kids apply different strategies or strategy mixes differently.

Either way, is there a premise change here?