Question: Write a function seq ( num ) that prints a sequence of numbers based on the following rules starting with num: If the current number

Write a function seq(num) that prints a sequence of numbers based on the following rules starting with num:
If the current number is even, next number = current number //2-1,
If the current number is odd, the next number = current number -1
Print the numbers of the sequence until the sequence reaches to or below 1.)(1. Note that the value of the first number of the sequence is "num" in the function call and then the series progresses.
Test Cases:
seq(100)
100494823221041
seq(67)
6766321514620
seq(10)
1041
 Write a function seq(num) that prints a sequence of numbers based

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!