ITC558 Collatz Sequence Programming Principles Assessment and Tutor Proposal
Charles Sturt University
ITC558 Collatz Sequence Programming Principles
Assessment No: 1
Student’s Score cards
Write a program to print out Collatz sequence (https://en.wikipedia.org/wiki/ Collatz_conjecture) for a user-supplied number. Prompt the user for a positive integer which will become the first number in the sequence. Next number in the sequence is derived as follows:
- If previous number is odd, the next number is 3 times the previous, plus 1.
- If previous number is even, the next number is half of the previous.
According to Collatz proposition, the sequence ultimately reaches 1 no matter what the starting number is.
Your program should print out all numbers in the sequence down to 1. At the end, display number of iterations it took to arrive at 1, and average of all values in sequence. For prettier output, insert a line break after printing every five numbers, align the numbers in columns and format the average value to two decimal places.
After printing a Collatz sequence, your program should ask the user if they want to print out another sequence. The loop will continue until user decides to quit.
Review the sample run below to clearly understand all requirements.
Draw a flowchart that presents the steps of the algorithm required to perform the task specified. You can draw the flowcharts with a pen/pencil on a piece of paper and scan it for submission, as long as the handwriting is clear and legible. However, it is strongly recommended to draw flowcharts using a drawing software. Here are links to some free drawing tools
- Draw.io (https://www.draw.io/)
- Lucidchart (https://www.lucidchart.com/pages/usecase/education) with an education account (register using firstname.lastname@example.org)
- yEd Graph Editor (https://www.yworks.com/products/yed)
- Pencil Project (https://pencil.evolus.vn/)
Implement your algorithm in Python. Comment on your code as necessary to explain it clearly.
Your submission will consist of: /p>
- Your algorithm through flowchart/s
- Source code for your Python implementation
Why invest in our services?
Our assignment help team is trained to provide you high quality writing services.
High scores achieved by our students is a portrayal of our high quality online assignment help
You can place your assignment order through 4 easy modes of communication