Collatz 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Collatz --version 3.0.0
                    
NuGet\Install-Package Collatz -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Collatz" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Collatz" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Collatz" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Collatz --version 3.0.0
                    
#r "nuget: Collatz, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Collatz@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Collatz&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Collatz&version=3.0.0
                    
Install as a Cake Tool

Collatz

This is a library that generates a sequence of integer values, based on the Collatz Conjecture. I'm primarly creating this package because I use this algorithm to demonstrate a number of development concepts in presentations, so having it as a NuGet package will make it easier to reuse it.

Getting started

Simply reference the Collatz NuGet package - that's it.

Prerequisites

This package targets .NET 8.

Usage

You can either get the entire sequence at once:

var sequence = CollatzSequenceGenerator.Generate(5);

// sequence will be [ 5, 8, 4, 2, 1 ]

Or get it as an enumerable:

foreach(var value in CollatzSequenceGenerator.GenerateStream(5))
{
  Console.WriteLine(value);
}

/*
The following sequence will print to the console: 

5
8
4
2
1
*/

Additional documentation

.NET Polygot Version in VSCode

The .ipynb files have been confirmed to work with Polyglot Notebooks v1.0.4102020. Later versions have compatiability issues with XPloty.

Feedback

If you run into any issues, please add them here.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Collatz:

Package Downloads
Collatz.Interactive

A library that extends the Collatz package for .NET Interactive Notebooks

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 154 11/28/2024
3.0.0 214 4/24/2024
2.0.0 429 3/14/2023
1.0.0 392 1/9/2022
0.3.0 383 11/16/2021
0.1.0 421 10/11/2021