<jupyter_start><jupyter_text>Exercise 2Related Notes:- Fundamentals_1_Data_Types- Fundamentals_2_Programming_Constructs  Exercise 2.1 Power Write a program that prints out the first $m$ numbers that can be written as an integer taken to the power $n$. Example interaction: >Input the number of terms, m: 5 >Input the n-th power: 3 >1>8>27>64>125<jupyter_code>#YOUR CODE HERE<jupyter_output><empty_output><jupyter_text>Exercise 2.2 Guess The Secret Number Write a program that stores a secret integer in a variable. The user has to guess the secret integer, the program should loop until they get it right.The problem: -   Decide on a secret integer between 1 and 100 inclusive yourself.-	Request an integer from the user. -	if the user inputted a value that is too high, print 'Your number is too high. Try again.' and the program loops-   if the user inputted a value that is too low, print 'Your number is too low. Try again.' and the program loops-   if the user inputted a value that is the same as the secret integer, print 'Congratulations. You guessed correctly.' and the program ends.Example interaction: >Secret number is 31>Input a quantity: 37 >Your number is too high. Try again. >Input a quantity: 25 >Your number is too low. Try again.>Input a quantity: 31 >Congratulations. You guessed correctly.<jupyter_code>#YOUR CODE HERE<jupyter_output><empty_output><jupyter_text>Exercise 1.3In mathematics, a **geometric sequence** is a sequence of real numbers $$u_1,u_2,\cdots, u_n$$such that the ratio between two consecutive terms is constant, i.e. $\frac{u_{n+1}}{u_n}=r$ for some constant $r\in \mathbb{R}\backslash \{0,1\}$, called the **common ratio** and $n\geq 1$.For example, the sequence $2,6,18,54,162,\dots$ is an arithmetic sequence with first term $2$ and common ratio $3$.Write a program to generate the first $n$ terms of an arithmetic sequence with a user defined first term $a$ and common ratio $r$.The problem: - Request a numeric input from the user to be used as the first term.  Let us denote this input as `first_term`.- Request a numeric input from the user to be used as the common difference.  Let us denote this input as `common_ratio`.- Request an integer input from the user for the number of terms.  Let us denote this input as `number_of_terms`.- Print out the sequence up to the $n$th term.Example interaction: >Please input the first term in the geometric sequence:>2>Please input the common ratio:>3>Please input the number of terms:>5>The first 5 terms of the geometric sequence are:>2>6>18>54>162<jupyter_code>#YOUR CODE HERE<jupyter_output><empty_output><jupyter_text>Exercise 2.4Given a geometric sequence with first term $a$ and common ratio $r$.Write a program that:- Request a numeric input from the user to be used as the first term.  Let us denote this input as `first_term`.- Request a numeric input from the user to be used as the common difference.  Let us denote this input as `common_ratio`.- Request an integer input from the user for the index for the term in the sequence.  Let us denote this input as `n`.- Print out the $n$th term in the sequence.- Print out the sum of the first $n$ terms in the sequence.Example interaction: >Please input the first term in the geometric sequence:>2>Please input the common ratio:>3>Please input the index :>5>The 5th term in the sequence is:>162>The sum of the first 5 terms in the sequence is:>242  Exercise 2.5Given a geometric sequence with first term $1$ and common ratio $r$. Find the sum of the first 100 terms of the sequence if:- $r=2$ - $r=\frac{1}{2}$ - $r=-3$ - $r=-\frac{5}{6}$ - $r=4.1$- $r=0.7$What can you conclude about the relationship between the common ratio of the geometric sequence with the sum of the first $n$ terms of the geometric sequence as $n$ grows larger and larger? i.e., as $n\rightarrow \infty$. You might want to try with more values of $r$.<jupyter_code>#YOUR CODE HERE<jupyter_output><empty_output><jupyter_text>Exercise 2.6 2019/NJC Tutorial/APGP/QB8 H2 Mathematics (Modified)An athlete is considering two plans for a training program.- Plan I: Run 2000 m on day 1, 2400 m on day 2, and on each successive day increase the distance run by 400 m.- Plan II: Run 2000 m on day 1, 2200 m on day 2, and on each successive day multiply the distance run by a constant factor $\frac{11}{10}$.(a) For Plan I, find the least value of $n$ for which the total distance run on days 1 to $n$, inclusive, exceeds 200 000 m.(b) For Plan II, find the least value of N for which the distance run on day $N$ exceeds 16 000.(c) Assume that athlete $A$ decided to go with Plan I and another athlete $B$ decided to with Plan II, when will athlete $B$'s total distance run first exceeds athlete $A$'s total distance run?<jupyter_code>#YOUR CODE HERE<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup