Archive for the ‘Algorithms’ Category


1. Hokey Pokey Algorithm

November 25, 2015

1a Mathspig Hokey pokey
Here’s the Hokey Pokey:

You put your right foot in
You take your right foot out
You put your right foot in
And you shake it all about
You do the hokey pokey
And you turn yourself around
That’s what it’s all about!

1b. Hokey Pokey

Why are algorithms as easy as the Hokey Pokey?

Because the Hokey Pokey is an algorithm or a set of steps that have to be taken to complete a task (see below) and the task is having fun and/or being really embarrassed by your parents in public. Whatever!

2. Algorithm 1
3. Algorithm 2
For more information about algorithms go to the Khan Academy here.

We are going to look at texts including a maths test to check their readability. Here are just a few songs with their age and Grade readability scores:
Hokey Pokey (above) = Grade 3 = 9 yo
Frosty the Snowman = Grade 5 = 11 yo
Hello by Adele = Grade 5 = 11 yo
Wildest Dream = Taylor Swift = Grade 3 = 9 yo
Russians* Sting = Grade 6 = 12 yo
* Most complicated lyrics I know. Any other suggestions?


2. Readability Algorithm

November 25, 2015

The above algorithms are called pseudocode because you do not type a letter to a computer to tell it what to do. You have to write code to instruct it.
But computer code, as my little sailor friend would say, uses a shipload of maths.
I am going to give you instructions by writing a letter to you because that is your CODE that you understand.
You are going to calculate the The Flesch–Kincaid reading score for The Hunger Games and a Harry Potter TEXT.
Don’t run screaming out the door. This is not too complicated.
The Flesch–Kincaid reading score or, quaintly, the F–K formula (Oops! Only one – )tells you the grade reading level of a text.
F-K formula
4. Flesch Kincaid Formula
We will use a basic version and a calculator:
5 F-K Formula Basic
You will need:
Word Count =
Sentence Count =
Syllable count =
The Flesch Reading Ease score is interpreted as follows:

6. Flesch Kinaid Readability Table

More info here.

READABILITY is important for Newspapers, books and websites

Text to be read by the general public should aim for a grade level of around 60 – 69 or Grade 8.
YA authors use the F-K formula to see if the text of their novel has the appropriate reading age.
YOU CAN TEST YOUR OWN WRITING! What reading age is your writing?



You may be able to SUE your BANK!!!!!!!!!

Contracts, by law in the US, should be written to a reading score of Grade 8. According to a recent article in the Telegraph, UK:
Insurance and banking customers who have been mis-sold financial products are more likely to be awarded compensation if they use a scientific test to prove policy documents were too difficult to read.
The “Flesch Kincaid” reading score is well established in the US, where most states require insurers’ policy documents to be written at no higher than a ninth-grade level (14–15 years of age) of reading difficulty.


Hunger Games And Harry Potter TEXT Readability
Readability Calculations: Method 1
You will do All calculations.
Readability Calculations: Method 2
You are the algorithm. You will cut and paste text into programs that auto-count words and syllables, collect this and other data from your computer and do the calculations using a calculator or online Web 2 calculator.
Readability Calculations: Method 3:
Cut and paste text directly into a Readability Calculator to get score.

Here are some interesting Readability Scores:

6a Readaility Score USA Constyitution


3.The Hunger Games Algorithm

November 25, 2015

The Hunger Games, Suzanne Collins TEXT

If Peeta and I were both to die, or they thought we were….My fingers fumble with the pouch on my belt, freeing it. Peeta sees it and his hand clamps on my wrist. “No, I won’t let you.” “Trust me,” I whisper. He holds my gaze for a long moment then lets go. I loosen the top of the pouch and pour a few spoonfuls of berries into his palm. Then I fill my own. “On the count of three?” Peeta leans down and kisses me once, very gently. “The count of three,” he says. We stand, our backs pressed together, our empty hands locked tight. “Hold them out. I want everyone to see,” he says. I spread out my fingers, and the dark berries glisten in the sun. I give Peeta’s hand one last squeeze as a signal, as a good-bye, and we begin counting. “One.” Maybe I’m wrong. “Two.” Maybe they don’t care if we both die. “Three!” It’s too late to change my mind. I lift my hand to my mouth taking one last look at the world. The berries have just passed my lips when the trumpets begin to blare. The frantic voice of Claudius Templesmith shouts above them. “Stop! Stop! Ladies and gentlemen, I am pleased to present the victors of the 74th Hunger Games, Katniss Everdeen and Peeta Mellark! I give you – the tributes of District 12!”


Readability Hunger Games: Method 1

The best way to count words and sentences is to cut and paste the text into a document and break the text up into sentences. This is a good exercise for students of all middle school students. You will find the text breakdown and syllable count here Hunger Games Readability

Word Count =

Sentence Count =

Syllable count =

Note: This last count will send you crazy. I kept getting different counts. Go with the middle count. ie. How many syllables in GIVE? G-ive. 2 syllables?

7. Hunger Games REadability Method 1


Readability Hunger Games: Method 2

Word Count =

Sentence Count =

Syllable count =

You will still have to do a sentence count, but you can cut and past the text into the following:

Word Counter


Syllable Counter


Word count = 234

Syllable count = 288

Sentence count = 26

8. Hunger Games Readability Method 2


Readability Hunger Games: Method 3

Simply cut and paste the text into here or here.

9 Hunger Games readaility Method 3



4. The Harry Potter Algorithm

November 25, 2015

Here is the Harry Potter Text:

Harry Potter and the Sorcerer’s Stone, J.K. Rowling

“Have you ever seen anything quite as pathetic?” said Malfoy. “And he’s supposed to be our teacher!”

Harry and Ron both made furious moves toward Malfoy, but Hermione got there first – SMACK!

She had slapped Malfoy across the face with all the strength she could muster. Malfoy staggered. Harry, Ron, Crabbe, and Goyle stood flabbergasted as Hermione raised her hand again.

“Don’t you dare call Hagrid pathetic you foul—you evil—”

“Hermione!” said Ron weakly and he tried to grab her hand as she swung it back.

“Get off Ron!”

Hermione pulled out her wand. Malfoy stepped backward. Crabbe and Goyle looked at him for instructions, thoroughly bewildered.

“C’mon,” Malfoy muttered, and in a moment, all three of them had disappeared into the passageway to the dungeons.

Hermione!” Ron said again, sounding both stunned and impressed.”


Readability Harry Potter: Method 1

Break the above text into sentences. Count the words, sentences and syllables.

You will find the text breakdown and syllable count here. Syllables in Harry Potter Text

Word Count =

Sentence Count =

Syllable count =

The syllable count is tricky. You will find my sentence-by-sentence count here.

10 Harry Potter Readability Method 1

Readability Harry Potter: Method 2

You will still have to do a sentence count, but you can cut and past the text into the following:

Word Counter


Syllable Counter


Word count = 138

Syllable count = 194

Sentence count = 14

11 Harry Potter readability Method 2

Readability Harry Potter: Method 3

You can calculate the Flesch Kincaid Score by cutting and pasting text here or here:

12 Harry Potter Readability Method 3


5. Maths Test Readability Algorithm

November 25, 2015

Here is the text from a Grade 3 Math Test:

See Fear and Loathing in Grade 3 Math

Math homework

Math formative.

I can use multiplication strategies to help me multiply.

I can use the structure of a word problem to help me solve it.

Solve the word problem below. Be sure to show your work. Julie bought 7 packages of cupcakes. Each package has 4 cupcakes in it. How many cupcakes did Julie buy?

Flesch Kincaid Score = 81.4

Grade Reading Level = Grade 5

Reading Age = 10 – 11 years

This is a bit tough for Grade 3 students. Perhaps more Maths tests should be tested for AGE READING LEVELS!!!!!