Collatz 2.0.0
See the version list below for details.
dotnet add package Collatz --version 2.0.0
NuGet\Install-Package Collatz -Version 2.0.0
<PackageReference Include="Collatz" Version="2.0.0" />
paket add Collatz --version 2.0.0
#r "nuget: Collatz, 2.0.0"
// Install Collatz as a Cake Addin #addin nuget:?package=Collatz&version=2.0.0 // Install Collatz as a Cake Tool #tool nuget:?package=Collatz&version=2.0.0
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 works for both .NET 6 and .NET 7. If you're using .NET 7, the Generate()
and GenerateStream()
values use the IBinaryInteger<T>
interface to allow you to use any type that implements that interface.
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
Feedback
If you run into any issues, please add them here.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- No dependencies.
-
net7.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.
A changelog is available at https://github.com/JasonBock/Collatz/blob/main/changelog.md