Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fortran code

61 views
Skip to first unread message

Mantu Sah

unread,
Sep 14, 2022, 2:44:30 AM9/14/22
to
The 3n+1 problem/ Collatz Conjecture. Take a positive integer n, if its odd do 3n+1, otherwise in case of even divide it by 2. Perform this repeatedly and verify the number of sequence always reaches to 4->2->1

Thomas Koenig

unread,
Sep 14, 2022, 10:07:28 AM9/14/22
to
Mantu Sah <mn2...@gmail.com> schrieb:
That code is straightforward to write (but you have to watch for
overflow). It is also a question if (3*n+1)/2 should be called
a single step.

Or are you asking us to write it for you?
0 new messages