Thousands of tools! Check out Online Tools – I have now added thousands of tools.

I often have to generate the Collatz sequence so I created this simple online utility that does it for me. It lets you calculate however many 3n+1 sequence numbers you need, starting from any value. It works in the browser and is powered by alien technology from the future.

Collatz Sequence Generator Options

Start and Count
Number Separator
Collatz Base

Collatz Sequence Generator Examples (click to try!)

Collatz Sequence for an Odd Starting Number
This example generates the Collatz sequence for the odd number 31. The series reaches 1 in 106 steps and there is a total of 107 values in the sequence, climbing to a high of 9232 at the 73rd step and then falling to 1 at the last step.
31, 94; 47; 142; 71; 214; 107; 322; 161; 484; 242; 121; 364; 182; 91; 274; 137; 412; 206; 103; 310; 155; 466; 233; 700; 350; 175; 526; 263; 790; 395; 1186; 593; 1780; 890; 445; 1336; 668; 334; 167; 502; 251; 754; 377; 1132; 566; 283; 850; 425; 1276; 638; 319; 958; 479; 1438; 719; 2158; 1079; 3238; 1619; 4858; 2429; 7288; 3644; 1822; 911; 2734; 1367; 4102; 2051; 6154; 3077; 9232; 4616; 2308; 1154; 577; 1732; 866; 433; 1300; 650; 325; 976; 488; 244; 122; 61; 184; 92; 46; 23; 70; 35; 106; 53; 160; 80; 40; 20; 10; 5; 16; 8; 4; 2; 1
Starting Collatz sequence value.
How many values to generate?
Separate sequence terms with this value.
Decimal Base
Collatz Sequence from a Billion
In this example, we generate the Collatz sequence starting from one billion. In the process of iterating this series, we get 74 even and 27 odd numbers, and after exactly 100 steps we reach the value 1.
1000000000; 500000000; 250000000; 125000000; 62500000; 31250000; 15625000; 7812500; 3906250; 1953125; 5859376; 2929688; 1464844; 732422; 366211; 1098634; 549317; 1647952; 823976; 411988; 205994; 102997; 308992; 154496; 77248; 38624; 19312; 9656; 4828; 2414; 1207; 3622; 1811; 5434; 2717; 8152; 4076; 2038; 1019; 3058; 1529; 4588; 2294; 1147; 3442; 1721; 5164; 2582; 1291; 3874; 1937; 5812; 2906; 1453; 4360; 2180; 1090; 545; 1636; 818; 409; 1228; 614; 307; 922; 461; 1384; 692; 346; 173; 520; 260; 130; 65; 196; 98; 49; 148; 74; 37; 112; 56; 28; 14; 7; 22; 11; 34; 17; 52; 26; 13; 40; 20; 10; 5; 16; 8; 4; 2; 1
Starting Collatz sequence value.
How many values to generate?
Separate sequence terms with this value.
Decimal Base
Collatz Sequence of Powers of Two in Binary Base
In this example, we generate the Collatz series for the value of 1024, which is 10000000000 in binary. As this number is a power of two (210), then at each iteration step we always compute n/2 part of the Collatz algorithm and get an even number again, which is one power of 2 less than the previous number. After doing it 10 times, we reach the final value 1 and the Collatz algorithm terminates.
10000000000
1000000000
100000000
10000000
1000000
100000
10000
1000
100
10
1
Starting Collatz sequence value.
How many values to generate?
Separate sequence terms with this value.
Binary Base

How Does This Collatz Sequence Generator Work?

This Collatz sequence generator works entirely in your browser and is written in JavaScript. It uses the function collatz(n) to calculate the next series member. The function returns n/2 if n is even, otherwise, it returns n*3 + 1. To calculate all Collatz series values, it creates an array collatzSeq and push()es the starting value to it. Then, it starts a for loop, with the condition to stop if the number of iterations exceeds the count value (sequence length; specified in options). In the first loop iteration, it calls number = collatz(start), and in all the next iterations, it executes number = collatz(number). If at any point number is 1, then the loop also terminates. In every iteration, it adds the new number to the array collatzSeq and converts it to the selected base. The supported bases are binary, octal, decimal, and hex. Finally, it converts the collatzSeq array to a string with the separator between the numbers (separator can be set in options), by applying the join(separator) function to it.

Created by Browserling

This collatz sequence generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by our web developer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my tools, then I love you, too! Use coupon code TOOLLING to get a discount at my company.