Asignment Overview
This asignment wil give you experience on the use of loop and conditional statements. We are going
work with the juggler sequence https:/en.wikipedia.org/wiki/Juggler_sequence
Background
The juggler sequence is another of the wel known sequences similar to the Collatz sequence. It has the
following definition:
The symbol is the floor function, rounding any floating point value down to an integer. It is not
rounding as you would typicaly define it. It is esentialy truncation of the fractional part, leaving the
integer part of the floating point number. It returns a floating point number.
• floor(123.23) is 123.0
• floor(123.999) is 123.0
Some things to note about the juggle sequence:
• Every known starting number eventualy ends in the value 1. At that point the sequence ends.
• The numbers can get quite large, so make sure you use the correct type, a long. Even with the
correct types you can exced the size of a long integer.
o if that occurs, you wil se some strange results. Why is that?
• The cmath library provides a number of useful methods including pow, sqrt and floor
(look them up).
Some example sequences are on the Wikipedia page above
Project Description / Specification
Your program takes as input thre integer values (same line, space separated):
• the first two integers, the beginning and ending value in a range of integers you are going to
examine, as space separated integers. They are in that order: the first is the lower range and the
second is the upper range. Calculate the sequence for each value in that range inclusive of the
endpoints.
• the third integer a value indicating whether to print each sequence: 1 (indicating yes) or 0
(indicating no).
Your program wil print (look at the Mimir test cases for examples):
• the sequence for each number in the range on a separate line if the third input value is 1
o note in printing the sequence the numbers are followed by a comma, except for the last
number in the sequence. A personal pet peeve of mine.
• On a separate line, two comma separated numbers. For the sequence that is the longest, print
the starting number and the length of the sequence (again, se Mimir for format)
• On a separate line, two comma separated numbers. For the sequence that contains the biggest
number, print the starting number and the biggest number in that sequence.
Requirements
1. You should check that the first two input range numbers are >= 2, and that the smalest (the first
entered value) is indeed strictly smaler than the second (the second value). If not, the program
prints an eror mesage and halts
Deliverables
proj02/proj02.cp . The name of the directory is proj02, the name file you turn in should be
exactly proj02.cpp. Just like the lab, you must click on proj02, the directory under "Project 02 –
juggler sequence ", to submit to Mimir. Not the file, the directory.
Notes
1. The % (modulus) operator is useful for this project.
2. If you ask for a large enough element, you might overflow an integer. If you go big enough, you
wil overflow a long (though it wil take awhile).