Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A group of monkeys have N bananas in day 1. In the next each day, these monkeys eat half the number of current bananas plus
A group of monkeys have N bananas in day 1. In the next each day, these monkeys eat half the number of current bananas plus one more banana. When the number of the banana n is odd, its half is counted as the lower bound. For example, when 21, half of n should be 10, and 10+1=11 bananas will be eaten on this day. - Write a program to compute the number of bananas N in the first day, based on the current day d and current number of bananas n. The input of the program should be the current day d and current number of bananas n, and the output of the program should be the number of bananas N in the first day. We assume that before day d, the number of bananas n in every previous day is even. For example, if in day 3 we have n3 12, then the number of bananas in day 2 should be n2 (n3 + 1) * 2 = 26, and the original number of bananas in day 1 should be N = n1 = (n2 + 1) * 2 = 54. (3 marks) =
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