Skip to content

kgengler/Collatz-Conjecture-Steps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This code is public domain

A simple c program to calculate the number of steps
needed to reach 1 using the Collatz Conjecture. See
https://en.wikipedia.org/wiki/Collatz_conjecture for more information.

compile: make

You can test multiple numbers at once with a simple loop.

e.g. in bash the following will compute until ctrl-c is pressed
(assuming you compiled using the above example):


i=1;
while true; do
  collatz $i;
  let 'i = i + 1';
done


Fun fact, the largest number of steps needed to find 1 in the numbers
between 1 and 10,000 is 351; the number is 77031. 

About

Calculate the number of steps needed to reach the integer 1 using Collatz Conjecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published