DEV Community

loading...

Thwaites Conjecture - graphically

Divyajyoti Ukirde
I'm currently 🌱 learning and 🔭 working on the Javascript Ecosystem. 😄 Pronouns: she/her ⚡ Fun fact: I have a Computer Engineering background but the most credit goes to Google and Stack Overflow
・1 min read

What are conjectures?

Wikipedia says "In mathematics, a conjecture is a conclusion or a proposition which is suspected to be true due to preliminary supporting evidence, but for which no proof or disproof has yet been found".

So, from one of these conjectures, I came across was the Thwaites Conjecture.
The algorithm proceeds as below:
Think of a positive whole number,
if the number is odd, multiply by 3 and add 1,
if the number is even, just half it.
Keep repeating this procedure, you'll eventually reach 1.

So, to see why this is true, I thought of plotting every step on the graph to see if there is any pattern. You can go ahead and comment your observations. Unfortunately, I couldn't find any pattern but I understood how canvas was used.

I am currently in the process of improving this project.
The height and width need to be scaled properly to make all the points visible.

Any suggestions are welcome.

Happy coding!

Discussion (0)