2. 2 / 26
Won(1)drous Numbers
●
A simple mathematical rule
– That takes 1 minute to learn and only uses simple
arithmetic
●
That anyone can understand (8 to 80)
– Every child shown becomes curious and motivated to fnd
out what’s going on
●
That when repeated generates interesting, mind bending,
sequences
●
That always end in 1 (unproved)
●
Generating tree and other interesting visualisations
●
Stimulating a host of both very simple and deep, questions
– Primary school, GCSE, A-levels, Degree, Phd
3. 3 / 26
The rule
●
Start with a positive whole number (integer)
– If the number is even, divide it by 2
– If the number is odd, multiply it by 3 and add 1
●
Repeat
●
Example
12 6 3 10 5 16 8 4 2 1→ → → → → → → → →
4. 4 / 26
Questions for the class
●
Try diferent starting numbers?
●
Do all sequences end with 1?
●
How many numbers would you have to try?
●
Why do you think this is?
●
Do you think it could proved?
●
Why do some numbers generate much longer
sequences than others?
5. 5 / 26
Classroom competition
●
The children work alone or in teams
●
Try choosing their own starting number
●
They call out if they think they have generated
– The longest sequence
– The shortest sequence
– The biggest number in the sequence
6. 6 / 26
Let’s think about what is
happening
Spot the mistake
7. 7 / 26
Challenge 2
●
A race to fnd the frst number, below 30, to
generate a sequence of over 100 numbers
●
What is the length of the sequence?
●
What height (the biggest number) does the
sequence reach?
– That’s an unusual number, don’t you think?
8. 8 / 26
Loops
●
When you get to 4 the sequence is 4 2 1, but 1 is
odd, so multiply by 3 and add 1=4, a loop
– 4 2 1 4 2 1 … forever (infnite)
●
Do you think there could be other loops that
might prevent a fall to 1?
●
How might we go about fnding other loops?
9. 9 / 26
3n+1 Classroom session
●
Individually or in groups
– Lay out, on small cards, the numbers 1 to 100
– Pick a starting number and start crossing of numbers in
the sequence
– Pick a new starting number … immediately you come across
a number that was crossed of you know it will fall to 1 and
so you don’t need to repeat that
– Repeat until everything is crossed of
– If a number generated exceeds 100, make up a card for it
●
The exercise could be performed using a number grid rather
than cards
10. 10 / 26
3N+1 Visualisation session
●
Individual or group group
●
Lay out cards on the foor to
build up the tree
●
Give each a set of blank
cards on which they write
the next, or preceding,
number
●
Cards must join to cards
already laid down
●
The mess will gradually
evolve to the tree
11. 11 / 26
One child asked these
questions after building a tree
●
“Does every number in the world
sit somewhere in the tree?”
●
“Why are some branches longer
than others?”
●
“What’s special about the numbers
where there is a new branch?”
●
“Are even numbers generating
longer branches?”
●
“Do the sequences have a pattern?”
●
“Is it really like a real tree?”
12. 12 / 26
Forwards and backwards
●
When frst introduced to the rule the child works forwards, applying the rule to one
number and generating another
●
To build the tree, it helps to work backwards, fnding the number that would generate
the next number
– This introduces the child to thinking about the reverse of the rule
23
70 35
●
If you know this number its easy to go forward, just apply the rule
●
It’s harder for the child to go backwards
●
Can they see it? When they do, they have taken a big step forward
140
13. 13 / 26
Walks
●
For there to be a number that does not end in 1,
it must forever walk around all other numbers,
avoiding any number that does end in 1
●
The walk would have to be of infnite length
●
Is that possible do you think?
14. 14 / 26
The problem is easily coded
●
Test for odd and even
●
Calculate the next in the sequence
●
Input a start number, output (print)
the next
●
Iteration until answer = 1, stop
●
While iterating, count the length of
the sequence
●
While iterating, track of the highest
in the sequence
●
Output the starting number, height
and length
●
Build up the code in stages
15. 15 / 26
Scratch or Python could be
used
●
Previously the child has been
applying the rule themselves, in
their head or using a basic
calculator
●
They learn that a computer can
help
●
They learn that the rules they know
can be given to the computer
●
This allows them to experiment
with the problem much faster
●
They start to use the computer to
add to their tree
16. 16 / 26
More coding ideas
●
Think about creative ways to visualise 3N+1
– Plot numbers against the lengths of sequences
generated
– Plot numbers against the highest number
generated in their sequence
18. 18 / 26
Deeper questions
●
Why do some numbers appear frequently in the
sequences generated?
●
Is there a formula L=F(N) that can predict the
length of the sequence generated from the
starting number?
●
Is there a formula H=F(N) that can predict the
height of the sequence generated?
19. 19 / 26
More visualisation ideas
●
Plot the frequencies of numbers appearing in
sequences
●
Plot the frequencies of lengths of sequences
●
Plot the frequencies of heights of sequences
20. 20 / 26
A 3N+1 Coding Competition
●
In school or inter-school competition
●
Who can fnd, and therefore prove, the highest
number that drops to 1?
– Using a computer
– Proof to include code and sequence generated
●
Harder than it sounds due to computing time
and resources required
21. 21 / 26
Background
●
The 3n+1 problem is also
known as
– The Collatz conjecture
– The Ulam conjecture
– Kakutani’s problem
– Thwaite’s problem
– Hasse’s algorithm
– The Syracuse problem
●
Hailstone numbers, of which
there are variations
●
Paul Erdős [2004] said about
the Collatz conjecture:
"Mathematics may not be ready
for such problems." He also
ofered $5500 for its solution.
●
Jefrey Lagarias [2010] claimed
that based only on known
information about this
problem, "this is an
extraordinarily difcult
problem, completely out of
reach of present day
mathematics."
22. 22 / 26
Look what people are doing
with this to try to understand it
http://community.wolfram.com/groups/-/m/t/558256
This is basically a procedure which takes
n=2000 random numbers up to
max=200000000, calculates the Collatz
sequence for each of them and then turns
each sequence into a curve using the
AnglePath command: starting with 1, if the
current number is even, it turns
counterclockwise and if odd, it turns
clockwise (the numbers in these sequences
are mostly even, so I had to balance out the
angles a bit so that on average the
trajectories don't turn into a big spiral), and
the length of the step decreases like a
power of the number (1.2 in the picture).
You can see that some paths repeat many
times and most of the sequences at some
point coalesce with one of these "thick"
paths. More over, most (if not all) of the
smaller paths approach the thicker paths
from a particular side (I wonder what that
means).
24. 24 / 26
Python coding
●
Trinket.io
– Web based IDE, used by CodeClub
– Share code easily (remix)
– Also supports Scratch
●
Pycharm from JetBrains
– Free community edition IDE
– Windows, Mac, Linux