subject

I am giving away A TON of points. Can I please get some help writing this code? It is a bit confusing to me? Is it possible to write it in the simplest form possible? Task:

A Harris number is a number that is divisible by the sum of its digits. For example, the number 81 is a Harris number because the sum of its digits is 9 and 81 is divisible by 9.

A Flavius sequence is a numerical sequence that is generated under the following rules:

If n = 1, the sequence ends
if n is even, the next n is n/2
if n is odd, the next n is 3n + 1
There is a theorem that states that every positive integer n will generate a finitely long Flavius sequence. For example:

n=3: 3, 10, 5, 16, 8, 4, 2, 1
n=7: 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1
Flavius sequences are often identified as (n, sequence length), so (3, 8) or (7, 17).

Your task:

Write a program that prompts a user for an unknown number of numbers. The user will input positive integers one at a time and the system will respond whether or not the number is a Harris number and what the Flavius sequence length is. When the user enters an integer of 0 or less, the program will end and the following statistics will be displayed: The count of all Harris numbers entered and the longest Flavius sequence in the form (n, length).

Your program should have the following:

A method that determines whether or not a number is a Harris number and returns True or False
A method that calculates and returns the length of the Flavius sequence for any positive integer
A main (driving) portion of the program
Your code page should be commented appropriately. See the Number Fun program for examples of what should be included.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 14:00
Just a heads up these questions are relating to a program known as gimp. (these are all fill-in-the-blank)will give brainliest-! the tool option allows you to blur the edges of the selection making it look less sharp.which option do you choose in the add layer mask dialog box to turn your selection into a mask? is a type of filter that distorts a layer making it appear like you’re looking through dirty glass.in which drop-down menu do you find the option to add a blur to your background image layer? what shape appears when you’ve completed making your selection with the free select tool (to let you know you’ve reached the beginning of your selection)? when using the toggle quick mask, everything outside of the selection becomes a color.when painting with the color with the toggle quick mask on, it removes part of your selection making it smaller.when painting with the color with the toggle quick mask on, it adds to your selection making it larger.to use the paths tool, click and add (a tiny circle).to close your selection when using the paths tool, press and hold while clicking the first anchor point you created.the tool works just like the free select tool by clicking around an image to select it.
Answers: 2
question
Computers and Technology, 23.06.2019 01:50
Write a program that uses a random number generator to generate a two digit positive integer and allows the user to perform one or more of the following operations: a. double the number. b. reverse the digits of the number. c. raise the number to the power of 2, 3, or 4. d. sum the digits of the number. e. if the number is a two-digit number, then raise the first digit to the power of the second digit. f. if the number is a three-digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit. after performing an operation if the number is less than 10, add 10 to the number. also, after each operation determine if the number is prime. each successive operation should be performed on the number generated by the last operation. your program should not contain any global variables and each of these operations must be implemented by a separate function. also, your program should be menu driven. 7. (fraction calculator) write a program that
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
You know the right answer?
I am giving away A TON of points. Can I please get some help writing this code? It is a bit confusin...
Questions
question
Mathematics, 09.02.2021 21:40
question
Chemistry, 09.02.2021 21:40
question
English, 09.02.2021 21:40
question
Mathematics, 09.02.2021 21:40
Questions on the website: 13722361