ferdinandkeller / collatz_sequence

An algorithm to compute the collatz sequence for numbers.

Home Page:https://ferdinandkeller.github.io/collatz_sequence/collatz_sequence/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collatz Sequence

This algorithm will compute the length of the Collatz sequence for all numbers in a given range. It will then output:

  • The number in the provided range with the longest Collatz sequence.
  • The biggest number computed while computing the Collatz sequence.

Collatz Conjecture

The Collatz sequence is defined as follows:

  • If the number is even, divide it by 2.
  • If the number is odd, multiply it by 3 and add 1. And you repeat this process until you reach 1. The length of the sequence is the number of steps needed to reach 1.

The Collatz conjecture is the hypothesis that for any number, the Collatz sequence will always reach 1. Technically, the sequence could go on forever for some values, or end up in another cycle, nobody knows.

About

An algorithm to compute the collatz sequence for numbers.

https://ferdinandkeller.github.io/collatz_sequence/collatz_sequence/index.html


Languages

Language:Rust 100.0%