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 18:30
What type of weird relationship this is analogy show? dissolve: solidify: : noise: silence
Answers: 2
question
Computers and Technology, 22.06.2019 02:20
The reset circuit used on the four 3-bit counters analyzed in this activity reset the counts to zero (000). it makes sense for the up-counters to start at zero (000), but the down-counters should start at seven (111). what would you need to change so that the 3-bit binary down counter with j/k flip-flops you just created would reset to seven (111)?
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
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, 01.06.2021 20:30
question
Mathematics, 01.06.2021 20:30
Questions on the website: 13722367