https://github.com/dbc2201/collatzconjecture
https://github.com/dbc2201/collatzconjecture
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/dbc2201/collatzconjecture
- Owner: dbc2201
- Created: 2022-06-23T00:16:32.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-23T00:16:36.000Z (about 4 years ago)
- Last Synced: 2025-02-12T08:39:36.819Z (over 1 year ago)
- Language: Java
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Collatz Conjecture
## Java Programming Course
---
**Course 1**: Problem-Solving and Computational Thinking in Java
**Sprint 5**: Working with Looping Constructs
---
Problem Statement
---
Calculate the number of steps required to reach 1 from a given number `n` by following the Collatz sequence.
```math
f(n) = \begin{cases}\frac{3n+1}{2}&\text{ if $n$ is odd,}\\\frac{n}{2}&\text{ if $n$ is even.}\end{cases}
```
---
Task
---
1. Open the [source code file](src/main/java/io/github/dbc/CollatzStepsCounter.java) and complete the code.
2. Open the [test case file](src/test/java/io/github/dbc/CollatzStepsCounterTest.java) and run the test cases to
check your code.
---
Fun Resources
---
1. [List of number of steps to reach 1 for Collatz Conjecture from OEIS](https://oeis.org/A006577/b006577.txt)
2. [Collatz Conjecture on OEIS (One-Line Encyclopedia for Integer Sequences)](https://oeis.org/A006577)
3. [Collatz Conjecture on Wikipedia](https://en.wikipedia.org/wiki/Collatz_conjecture)
4. [UNCRACKABLE? The Collatz Conjecture - Numberphile](https://youtu.be/5mFpVDpKX70)
5. [Collatz Conjecture in Color - Numberphile](https://youtu.be/LqKpkdRRLZw)
6. [Conjecture meaning in the Cambridge English Dictionary](https://dictionary.cambridge.org/dictionary/english/conjecture)
7. [What is the Collatz Conjecture? - CollatzResearch.org](https://www.collatzresearch.org/chapter1-what-is-the-collatz-conjec)