3n + 1 sequence

by Ricardo “Rudxain” Fernández Serrata

Version 5 (September 26, 2023)

Download (24 downloads)

A "Collatz calculator" that supports negatives!

For negative integers, it's unknown whether this halts or not, because not all 53bit ints have been tested. For unsigned ints, it's guaranteed to halt, because `numbers` only have 53b of precision, and nums greater than 2^53-1 always have binary trailing zeros.

"Skip evens" (truthy `skip`) removes all binary trailing zeros from every int in the sequence.

The subroutine is intended to be embedded in flows. It can work with non-ints, but it will return wrong results.

https://en.wikipedia.org/wiki/Collatz_conjecture

Rudxain profile: llamalab.com/automate/community/flows/42921

Tags: math OEIS even odd number function algorithm Hailstone sequence

LICENSE: https://unlicense.org

3.0 average rating from 1 reviews

5 stars
0
4 stars
0
3 stars
1
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.