Dan Meyer, a highschool teacher, gave a very interesting TED talk about problem solving in math class. He shows that current text books don’t teach problem solving at all but instead focus on plugging values into formulas.

Dan also suggests how to make the class much more interesting by incorporating real-life examples.

Write a function that takes an integer and returns the length of that integer, i.e. the number of digits.
Example: 2011 has length 4.
Test your function with the following integers:
a) 31415926
b) 1000
c) 5
d) 0

I already posted a solution last time but the following crossed my mind:
We can convert Read the rest of this entry »

Last time we talked about cutting a number. Today we have the following problem:

Write a function that takes an integer and returns the length of that integer, i.e. the number of digits.
Example: 2011 has length 4.
Test your function with the following integers:
a) 31415926
b) 1000
c) 5
d) 0
Bonus: Write a non-recursive and a recursive function.

Last time we talked about calculating the sum of the integers from 1 to N. Today we deal with the following problem:

Given an integer, e.g. 31415926, produce the following output:
31415926
3141592
314159
31415
3141
314
31
3
So, you have to cut the number from right to left.

a) Write a function with a while loop that produces this output.
b) Write a function without a while loop producing the output (Hint: recursion).
Part b) is a little difficult if you don’t have experience with recursion.

Test your function with the following integers:
31415926, 1000, 5 and 0

Last time we talked about finding the greatest integer in an array. Today we deal with the following problem:

Find the sum of the integers from 1 to 100 using:
a) a for loop
b) a while loop
c) the Gauss formula
d) without using “for” and “while” (Hint: recursive function)

In biochemistry one wants to determine the structure of a protein which proves to be difficult. A new approach is the game foldit. You are given a protein with the goal of finding the structure with the lowest possible energy configuration. There is a score loaderboard that motivates players.

Here is a nice video of what has been achieved lately: msnbc report
A good article on foldit can be found on wired.com

And here’s a video of someone actually playing the game: