subject

Suppose that the first number of a sequence is x, where x is an integer. define: a0 = x; an+1 = an / 2 if an is even; an+1 = 3 x an + 1 if an is odd. then there exists an integer k such that ak = 1. instructions write a program that prompts the user to input the value of x. the program outputs: the numbers a0, a1, a2, . . , ak. the integer k such that ak = 1 (for example, if x = 75, then k = 14, and the numbers a0, a1, a2, a14, respectively, are 75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1.) test your program for the following values of x: 75, 111, 678, 732, 873, 2048, and 65535.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
This isn’t really school related, but like where the heck can you find manga, to read to where you don’t have to pay money, for points? my friend wants me to read bj alex, and i can’t find it anywhere for free.
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 25.06.2019 04:10
While creating a web page, what does each of the following html tags define? 1. 2. 3. 4. a. defines a new paragraph b. defines a term c. defines a single line break d. defines a heading
Answers: 1
question
Computers and Technology, 25.06.2019 08:10
The component of an information system consists of raw facts and by itself
Answers: 1
You know the right answer?
Suppose that the first number of a sequence is x, where x is an integer. define: a0 = x; an+1 = an...
Questions
question
Mathematics, 25.02.2021 23:30
question
Mathematics, 25.02.2021 23:30
question
Mathematics, 25.02.2021 23:30
Questions on the website: 13722363