Red Huang

Red Huang

UVA 100

A very simple classic problem

It's also known as the famous Collatz Conjecture

It states that for a number, if it's odd, multiply by 2 and add 1

If it's even, divide by 2

This process will eventually reach 1

The task is to calculate the cycle length of all numbers in a given range

And find the maximum cycle length

Note that initially a and b may not be a~b, it could be b~a

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.