Question
in python Write a function divisorsOfN that takes an int n2 and Sample Input: n2 = 30 Sample Output l = [1, 2, 3, 5,
in python
Write a function divisorsOfN that takes an int n2 and Sample Input: n2 = 30 Sample Output l = [1, 2, 3, 5, 6, 10, 15, 30] returns a list of all divisors of n2.
Write a function hailstone that takes an int n3 and prints the hailstone sequence. Hailstone Numbers: This sequence takes the name hailstone as the numbers generated bounce up and down. To generate the sequence, follow these rules: a. If the number is odd multiply it by 3 and add 1 b. If the number is even, divide by two. c. Repeat until you reach number 1. Sample Inputs & Outputs n3 = 3 -> 10, 5, 16, 8, 4, 2, 1 n3 = 6 -> 3, 10, 5, 16, 8, 4, 2, 1 n3 = 7-> 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started