{"id":27183185,"url":"https://github.com/boreec/toolkit-collatz-conjecture","last_synced_at":"2026-06-19T21:31:56.997Z","repository":{"id":185067933,"uuid":"672954484","full_name":"boreec/toolkit-collatz-conjecture","owner":"boreec","description":"Interactive Rust application for visualizing and experimenting with the Collatz Conjecture.","archived":false,"fork":false,"pushed_at":"2023-08-20T09:41:31.000Z","size":3012,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T15:57:50.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boreec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-31T14:36:40.000Z","updated_at":"2024-04-28T08:37:39.000Z","dependencies_parsed_at":"2025-04-09T15:57:56.629Z","dependency_job_id":"54679a4e-785a-4839-bc82-18de5d4eb23f","html_url":"https://github.com/boreec/toolkit-collatz-conjecture","commit_stats":null,"previous_names":["boreec/collatz-conjecture","boreec/toolkit-collatz-conjecture"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/boreec/toolkit-collatz-conjecture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Ftoolkit-collatz-conjecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Ftoolkit-collatz-conjecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Ftoolkit-collatz-conjecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Ftoolkit-collatz-conjecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boreec","download_url":"https://codeload.github.com/boreec/toolkit-collatz-conjecture/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boreec%2Ftoolkit-collatz-conjecture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34549340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-09T15:55:33.955Z","updated_at":"2026-06-19T21:31:56.989Z","avatar_url":"https://github.com/boreec.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# collatz-conjecture (WIP)\n\nThe [Collatz conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture),\nalso known as the 3n + 1 problem, is a mathematical conjecture that involves a\nsequence of steps applied to a positive integer `n`.\n\nGiven a positive unsigned integer `n`, the following rules are applied:\n- If `n` is even, divide it by 2.\n- If `n` is odd, multiply it by 3 and add 1.\n\nRepeating these rules by updating the value of `n` with each step will\neventually lead to `n` becoming equal to 1, regardless of the initial value of\n`n`.\n\nFor example, if we start with `n` = 10:\n```text\n10 -\u003e 5 -\u003e 16 -\u003e 8 -\u003e 4 -\u003e 2 -\u003e 1\n```\n\nDespite its simplicity, the Collatz conjecture's behavior is not yet fully\nunderstood and remains an unsolved problem in mathematics.\n\nThe purpose of this application is to give a toolbox to explore this problem\nunder different angles.\n\n# To do list\n\nA personal remainder on what to do:\n- Add memoization for efficient bulk sequence computing.\n- Improve tree rendering by putting the nodes with a small delta to the same\nlevel.\n- Display specific integers in the tree (perfect, semi-perfect, prime, etc).\n- Compute steps densitiy for a group of sequences.\n- Improve existing github workflow.\n- Add markdown style comments to document code.\n- Generalize CollatSequence to other forms (5x + 1, negative numbers, etc).\n\n# Installation\n\n## Additional dependencies\n\n- for plotting: pkg-config libfreetype6-dev libfontconfig1-dev\n\n# Usage\n\nUse `-h` or `--help` for a summary of arguments and options.\n\n## Sequence for a single number\nTo compute a Collatz sequence from a number n, use `--start` or `-s`:\n```terminal\n$ cargo run -- --start 10\nCollatzSequence { hailstone: [10, 5, 16, 8, 4, 2, 1], starting_number: 10 }\n```\n\n## Plotting sequence\nTo compute a Collatz sequence from a number n, and plot it, use the same command\nas above with `--plot` or `-p`. The plot will be saved as `sequence_from_n.png`,\nwhere `n` is the starting number. For example:\n```terminal\n$ cargo run -- -s 27 -p \u0026\u0026 display sequence_from_27.png\n```\n![Collatz Sequence for n = 27](rsc/img/sequence_from_27.png)\n\n## Bottom-up tree\nTo build the sequence in a reverse order from 1 to given n, use `--tree`  (or\nits alias `-t`). You can also use `--tree-fancy` (or its short alias\n`-T`) to create a colourful tree.\n\nThis will create the bottom-up tree and export it in a file named\n`tree_to_n.dot`. This file can then be processed into an image with:\n```terminal\n$ cargo run -- -s 1000 --tree \u0026\u0026 \\\n  dot -Tpng tree_to_1000.dot \u003e tree_to_1000.png\n```\n\u003ctable\u003e\n\u003cthead\u003e\n  \u003ctr\u003e\n    \u003cth\u003e--tree\u003c/th\u003e\n    \u003cth\u003e--fancy-tree\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"rsc/img/tree_to_2000.png\" width=\"300\"\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"rsc/img/tree_fancy_to_2000.png\" width=\"300\"\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n## Benchmarking\nUse `-b` or `--benchmark` with a number to compare the efficiency of diverse\nmethods for computing all steps for the first n numbers. For example:\n```terminal\n$ cargo run -- -b 100\nTime elapsed to compute steps on sequences from 1 to 100: 88.37µs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboreec%2Ftoolkit-collatz-conjecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboreec%2Ftoolkit-collatz-conjecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboreec%2Ftoolkit-collatz-conjecture/lists"}