An open API service indexing awesome lists of open source software.

https://github.com/dbc2201/collatzconjecture


https://github.com/dbc2201/collatzconjecture

Last synced: about 1 year ago
JSON representation

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)