Collatz Conjecture Playground Jun 12, 2018 | 1 minute

Starting value: 10.00

Found solution in: 6.00 steps

1.02.03.04.05.06.051015
x
y
0
10
1
5
2
16
3
8
4
4
5
2
6
1
Loading...

This was written using the Idyll markup language for creating interactive documents. The Idyll code to create this page is:

Starting value: [var name:"number" value:10 /]  [Range value:number min:1 max:100 /] [Display value:number /]

[var name:"createJson" value:`function(max, step, number) {
var data = [];
function iterate(max, step, number) {
var newNumber;
if (number % 2 === 0) {
   newNumber = number / 2;
} else {
   newNumber = 3*number + 1;
}
if (newNumber !== 1 && step < max) {
   data.push({
       x: step,
       y: newNumber
   });
   iterate(max, step + 1, newNumber);
} else {
   data.push({
       x: step,
       y: newNumber
   });
}
}
data.push({
x: step,
y: number
});
iterate(max, step + 1, number);
return data;
}` /]

Found solution in: [Display value:`createJson(200, 0, number).length - 1` /] steps

[Chart data:`createJson(200, 0, number)` /]

[Table data:`createJson(200, 0, number)` /]

© 2021 Floyd Hightower

Powered by Hugo with theme Dream.

avatar
About me

Welcome! I’m Floyd Hightower.

I am a programmer who is passionate about making the world a better place using technology.

Principles

Life Principles

Here are some of the principles I try apply to every area of my life:

  • Let your ideas see the light of day
  • Always be willing to accept feedback and criticism (even when it is poorly delivered)
  • Rome ne s’est pas faite en un jour (Rome wasn’t built in a day)
  • Don’t be too proud to follow a good example
  • Loose ends always unravel
  • Unanswered questions never go away
  • The Tisroc won’t live forever whether you want him to or not
  • Talk less; listen more
  • Use more semi-colons
  • Use oxford commas
  • Learn how to politely say “No”
  • Don’t let the possibility of failure scare you away from starting something
  • To do something, you have to do something
  • A whiteboard is worth a thousand laptops
  • Ideas have consequences