Skip to content

alexj136/collatz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Java Collatz graph drawing program - generates graphs of Collatz numbers ("3n + 1 problem") and draws the graphs using graphviz.

The interesting stuff is in the file Collatz.java above.

Requires Java 7 (JDK and JRE) and graphviz.

Run the ./run script with a single integer argument n, and a png will be output with the collatz graph including every integer up to n, plus any additional numbers generated by incorporating all numbers less than or equal to n into the graph:

./run CollatzRule 100

Alternatively run the following commands, plugging in whatever number you like to the second command:

javac collatz.java
java Main CollatzRule 100 > g.dot
dot -Tpng g.dot -o g.png

Either method generates an image file g.png with your graph.

About

Drawing Collatz graphs with Java and Graphviz

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published