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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 03:30, mem81
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
image
Computers and Technology, 23.06.2019 15:30, jasssp
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
image
Computers and Technology, 24.06.2019 01:30, BIKRAMlawati5544
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
image
Computers and Technology, 24.06.2019 10:00, alexapacheco012
What did i do wrong with this const discord = require('discord. js'); var bot = new discord. client(); const token = 'ntm3mjcxmtu1mjg3ote2ntq2.dyogew. dpfiwfpuifzuzvifop-csuxasnm' const prefix = "! " bot. registry. registergroup('simple', 'simple'); bot. registry. registerdefaults(); bot. registry. + '/commands'); bot. on('message', message => { if(message. content == 'hi! ') { message. channel. send ('@everyone sup, how is @everyone day going'); } if(message. content == 'h3lp') { message. channel. send ('dose not have any commands yet'); } bot. on('ready', function() { console. log("ready") }); bot. login(token);
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 in other subjects:

Konu
Arts, 24.10.2020 01:10
Konu
Mathematics, 24.10.2020 01:10