Edgar created this interesting visualization inspired by a blog post by @matthen2. The concept is simple. - Start with a number between 1 and 99: e.g. "42"
- Spell out the number: "forty-two"
- Count the number of letters in the spelled out number, excluding hyphen: "8"
- Repeat steps 2 and 3 until the same number is reached: "eight" → "5" → "five" → "4" → "four" → "4"
With Edgar's code, you can visualize this for all numbers from 1 to 99. To get the word representations of the numbers, I'm using another Pick from the past, Number to Words. number_words = cell(size(numbers));
for id = 1:length(numbers)
number_words{id} = num2words(numbers(id));
plotDirectedGraph(numbers,number_words)
I modified Edgar's plotDirectedGraph function to animate the creation of the graph.
Give this a try and leave a comment for Edgar.
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.