Sunday, October 6, 2024
Google search engine
HomeData Modelling & AIGFact | Collatz Sequence

GFact | Collatz Sequence

Starting with any positive integer N, we define the Collatz sequence corresponding to N as the numbers formed by the following operations:

N → N/2 ( if N is even)
N → 3N + 1 (if N is odd)

i.e. If N is even, divide it by 2 to get N/2. 
If N is odd, multiply it by 3 and add 1 to obtain 3N + 1.



It is conjectured but not yet proven that no matter which positive integer we start with; we always end up with 1.

For example, 10 → 5 → 16 → 8 → 4 → 2 → 1

A Coding Practice Question on Collatz Sequence

If you like neveropen and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the neveropen main page and help other Geeks.

Feeling lost in the world of random DSA topics, wasting time without progress? It’s time for a change! Join our DSA course, where we’ll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 neveropen!

RELATED ARTICLES

Most Popular

Recent Comments