Tutor profile: Ryan G.
Questions
Subject: Discrete Math
Suppose n is a positive integer such that $$n \text{ mod } 4 = 1$$. Prove $$(n + 6) \text{ mod } 4 = 1$$
Since we know that $$n \text{ mod } 4 = 1$$ We can deduce that $$(n + 1) \text{ mod } 4 = 2$$ since increasing n by 1 increases the remainder by 1, as long as the remainder is less than 4. Similarly, we can do that two more times and know that $$(n + 3) \text{ mod } 4 = 0$$ And going 3 steps further: $$(n + 3 + 3) \text{ mod } 4 = 1 + 3 + 3 \text{ mod } 4 = 7 \text{ mod } 4 = 3$$
Subject: Computer Science (General)
Write a Recursive Algorithm to find the value of an integer n raised to any power m where m $$\geq$$ 0
In this function we should have 2 inputs n & m which are the Integer and the Power to raise it to respectively. Our Base Cases will be when m is 0 or 1, in which case the result is 1 or n respectively. As the func pow(n, m) if (m == 0) return 1 if (m == 1) return n return n * pow(n, m - 1)
Subject: Algebra
Consider a Function f(x) which yields the price of a box of Tacos. The Box costs $5 and includes 8 Tacos, but additional Tacos can be added for $0.50 per Taco, Write the formula for the Price of a box of Tacos of any size greater than 5.
Let's first consider what information we need to represent in the formula. f(x) (should) equal the price of a box of tacos, when x is the number of additional tacos we would like to purchase on top of the 8 included with the box. So we can say our INPUT is the Number of Tacos $$ = x$$ OUTPUT is the Price of a Box of x Tacos That default 8 is unnecessary to consider in our formula, which should always be at least $5, since $$f(0) = 5$$ So with that base $5 we then add the total cost of additional tacos, which can be represented by (Number of Tacos) $$ * $$ $$0.5 = x * 0.5 = 0.5 * x = \frac{1}{2} * x = x/2$$ $$f(x) = \frac{x}{2} + 5$$
Contact tutor
needs and Ryan will reply soon.