Image from Pixabay The Fibonacci sequence was first observed by the Italian mathematician Leonardo Fibonacci in 1202. He was investigating how fast rabbits could breed under ideal circumstances. He made the following assumptions:
Fibonacci asked how many pairs of rabbits would be produced in one year. Can you create the numbers yourself? Remember to count the 'pairs' of rabbits and not the individual ones. Try it. Were you able to come up with the Fibonacci numbers? If not, here is how you would do it.
The pattern comes out to be 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233. Fibonacci numbers are of interest to biologists and physicists because they are frequently observed in various natural objects and phenomena. For example, the branching patterns in trees and leaves are based on Fibonacci numbers. On many plants, the number of petals is a Fibonacci number: buttercups have 5 petals; lilies and iris have 3 petals; some delphiniums have 8; corn marigolds have 13 petals; some asters have 21 whereas daisies can be found with 34, 55 or even 89 petals. How can we create a rule (algorithm) for the fibonacci series (sequence)? First, the terms are numbered from 0 onwards like this: n = 0 1 2 3 4 5 6 7 8 9 10 ... xn =0 1 1 2 3 5 8 13 21 34 55 ... What rule can we create here? Well, if you look, x3 = x2 + x 1 (2 = 1 + 1) and x4 = x2 + x3 (3 = 1 + 2), etc. So we can write the rule (algorithm) as: xn = x(n1) + x(n2). where:
Example: term 7 is calculated as: x7= x(71) + x(72) = x6 + x5 = 13 + 8 = 21 Let's write programs in Python to calculate the Fibonacci numbers. 1. With looping: def fib(n): a,b = 1,1 for i in range(n1): a,b = b,a+b return a print(fib(1)) print(fib(2)) print(fib(3)) print(fib(4)) print(fib(5)) print(fib(6)) print(fib(7)) print(fib(8)) 1. With recursion: def fibR(n): if n==1 or n==2: return 1 return fibR(n1)+fibR(n2) print(fibR(1)) print(fibR(2)) print(fibR(3)) print(fibR(4)) print(fibR(5)) print(fibR(6)) print(fibR(7)) print(fibR(8)) N.B: No not copy and paste the python code as identation is important.
0 Comments
The greatest common divisor (GCD) or the highest common factor (HCF) of two numbers is the largest positive integer that perfectly divides the two given numbers. Solving this problem for a specific set of numbers is easy. For example, find the GCD of 12 and 18. The The divisors of 12 are 1, 2, 3, 4, 6, 12 and for 18 are 1, 2, 3, 6, 9, 18. The common factors are 1, 2, 3, and 6. So the greatest common factor is 6. How would you find the GCD for any number? Here the problem is more challenging. Here is one solution. Let's take two integers a and b passed to a function which returns the GCD. In the function, we first determine the smaller of the two number since the GCD (HCF) can only be less than or equal to the smallest number. For example, the GCD of 12 and 14 can only be less than 12 and not greater. We then use a for loop to go from 1 to that number. In each iteration, we check if our number perfectly divides both the input numbers. If so, we store the number as the GCD. At the completion of the loop we end up with the largest number that perfectly divides both the numbers. Below is the algorithm in python. def computeGCD(a, b): if a < b: smaller = a else: smaller = b for i in range(1, smaller+1): if (a % i == 0) & (b % i == 0): gcd = i return gcd print(computeGCD(24, 16)) print(computeGCD(48, 256)) N.B: Do not cut and paste the above code. Make sure the indentation is correct. The above method is easy to understand and implement but not efficient. A much more efficient method to find the GCD (HCF) is the Euclidean algorithm. The Euclidean algorithm is based on the principle that the greatest common divisor of two numbers does not change if the larger number is replaced by its difference with the smaller number. That is a mouthful! Let's make it simple by taking an example. 21 is the GCD of 252 and 105 (as 252 = 21 × 12 and 105 = 21 × 5), and the same number 21 is also the GCD of 105 and 147 (252 − 105). Since this replacement reduces the larger of the two numbers, repeating this process gives successively smaller pairs of numbers until the two numbers become equal. When that occurs, they are the GCD of the original two numbers. A more efficient version of the algorithm shortcuts these steps, instead we divide the greater by smaller and take the remainder. Now, divide the smaller by this remainder. Repeat until the remainder is 0. For example, if we want to find the H.C.F. of 54 and 24, we divide 54 by 24. The remainder is 6. Now, we divide 24 by 6 and the remainder is 0. Hence, 6 is the required GCD. Python code for Euclidean Algorithm def euclidAlgo(a, b): while (b): a, b = b, a % b return a print(euclidAlgo(24, 16)) print(euclidAlgo(48, 256)) Python code for Euclidean Algorithm using recursion: def euclidAlgo(a, b): if (b == 0): return a else: return euclidAlgo(b, a % b) print(euclidAlgo(24, 16)) print(euclidAlgo(48, 256)) Sources: Wikipedia; https://www.programiz.com/pythonprogramming/examples/hcf
Free Image from Pixabay Finding Prime NumbersPrime numbers are very important, yet many students do not see the value of learning them. Primes have several applications, most importantly in information technology, such as publickey cryptography, which relies on the difficulty of factoring large numbers into their prime factors. One key challenge is to find prime numbers. Interestingly, Prime numbers and their properties were first studied extensively by the ancient Greek mathematicians. Euclid, for example, proved that there are infinitely many prime numbers. Just to refresh our memory, a number greater than 1 is called a prime number, if it has only two factors, namely 1 and the number itself. Proof by Contradiction One of the first known proofs is the method of contradiction. It is used to calculate prime factors of large numbers. Calculating prime factors of small numbers is easy. For example, the factors of 17 is 1 and 17, so it is a prime number. What about large numbers? Let's look at the proof by contradiction method. If a number n is not a prime, it can be factored into two factors a and b, such that n = a*b. For example, let's say a * b = 100, for various pairs of a and b. If a = b, then they are equal, we have a*a = 100, or a^2 = 100, or a = 10, the square root of 100. If one of the numbers is less than 10, then the other has to be greater to make it to 100. For example, take 4 x 25 = 100. 4 is less than 10, the other number has to be greater than 10. In other words, if a * b, if one of them goes down, the other number has to get bigger to compensate so the product stays at 100. Put mathematically, the numbers revolve around the square root of their product. Let's test if 101 is prime number. You could start dividing 101 by 2, 3, 5, 7, etc, but that is very tedious. A better way is to take the square root of 101, which is roughly equal to 10.049875621. So you only need to try the integers up through 10, including 10. 8, 9, and 10 are not themselves prime, so you only have to test up through 7, which is prime. Because if there's a pair of factors with one of the numbers bigger than 10, the other of the pair has to be less than 10. If the smaller one doesn't exist, there is no matching larger factor of 101. Let's now build an algorithm using this method to test any number for primality. Algorithm in Pythonimport math def isPrime(num): if (num < 2): return False else: for i in range(2, int(math.sqrt(num)) + 1): if num % i == 0: return False return True print(isPrime(33)) print(isPrime(0)) print(isPrime(47)) print(isPrime(1047)) print(isPrime(11)) print(isPrime(59392847)) N.B: Do not just copy the code because you have to be careful with indentation in python. Try the above algorithm and let us know if you found it useful or have alternative solutions.
N.B. This is for SAT Subject Test Math Level 2 Problem:What is the sum of the infinite geometric series:
6 + 4 + 8/3 + 16/9 + ... ? (A) 18 (B) 36 (C) 45 (D) 60 (E) There is no sum. ProblemIn April of 2004, d dogs and c cats lived in an animal shelter. If 4 cats arrived at the shelter in May of 2004 and the ratio of dogs to cats remained unchanged, in terms of c and d, how many dogs arrived at the shelter in May of 2004?
(A) 4 (B) 4d/c (C) d/c (D) d^2  4d (E) (2cd + 4d)/c
In the complex plane, the horizontal axis is called the real axis and the vertical axis is called the imaginary axis. The complex number a + bi graphed in the complex plane is comparable to the point (a, b) graphed in the standard (x, y) coordinate plane. The modulus of the complex number a + bi is given by:
\[\sqrt{a^2 + b^2}\]
Question:
Which of the complex numbers z1, z2, z3, z4 and z5 below has the greatest modulus?
Answer:
Okay, so what is this question really asking?
All it is asking is for you to find the largest value of the square root of the sum of the squares of our coordinate points, or find:
\[\sqrt{x^2 + y^2}\]
The challenge is that we are not given the real x and y values of the coordinate points. So we have to estimate the coordinate points of our z points.
Because we are working with squares, negatives are not a factor, so we can eliminate the smaller numbers as we are just taking a number, positive or negative and taking the square of it. Let us estimate our coordinates: â€‹ z1 = (4, 5) z2 = (2, 1) z3 = (2, 3) z4 = (2, 2) z5 = (4, 2) We are looking for whichever point has the largest combination of its coordinate points. At a glance, the two points with the largest coordinates are z1 and z5. Let's find the modulus of z5, and smaller of the two.
\[\sqrt{4^2 + (2)^2}\]
\[\sqrt{16 + 4}\]
\[\sqrt{20}\]
\[4.5\]
And the modulus of z1:
\[\sqrt{(4)^2 + 5^2}\]
\[\sqrt{16 + 25}\]
\[\sqrt{41}\]
\[6.4\]
We can see that the modulus of z1, 6.4, is higher than that of z5.
Final answer: F, z1. Two whole numbers have a greatest common factor of 8 and a least common multiple of 48. Which of the following pairs of whole numbers will satisfy the given conditions?
F. 4 and 9 G. 5 and 10 H. 10 and 16 J. 14 and 20 K. 16 and 24 ProblemSamantha is making gluten free brownies for the family picnic. If the recipe calls for 2 ½ cups of cocoa to serve 4 people, how many cups will he need if there will be 60 people at the picnic? SolutionSamantha's recipe calls for 2 ½ cups of cocoa to serve 4 people. Or, in other words, > 4 people require 2 ½ cups of cocoa. > 1 person would then require (2 ½) / 4cups of cocoa, which is 0.625 cup of cocoa. > So 60 people would require 0.625 x 60 cups of cocoa = 37.5 cups of cocoa. Answer: 37.5 cups of cocoa. Ingredients
Instructions
Source: http://www.kingarthurflour.com/recipes/glutenfreebrowniesrecipe Problem:
An interior designer is creating a custom coffee table for a client. The top of the table is a glass triangle that needs to balance on a single support. If the coordinates of the vertices of the triangle are at (3, 6), (5, 2), and (7, 10), at what point should the support be placed?
A proportion is a set of 2 fractions that equal each other. This article focuses on how to use proportions to solve cooking problems, especially when the numbers are not friendly. But first, let's start with an easy problem.
Let's say you are cooking rice to serve exactly 3 people. The recipe calls for 2 cups of water and 1 cup of dry rice. However, you found out that there are 12 guests coming. How would the recipe change? If you’ve ever made rice, you know that this ratio — 1 part dry rice and 2 parts water — is important. Mess it up, and your rice will become soggy or something else. Because you are quadrupling your guest list (3 people * 4 = 12 people), you must quadruple your recipe. Cook 8 cups of water and 4 cups of dry rice. This demonstrates how you can use ration to solve proportion problems in real life. What happens when the numbers are not so friendly? Let's say you are throwing a party for 25 people. How much water do you need? Question
What is the solution set for the above equation?
A) {5} B) {20} C) {−5, 20} D) {5, 20} QuestionA car is traveling at x feet per second. The driver sees a red light ahead, and after 1.5 seconds reaction time, the driver applies the brake. After the brake is applied, the car takes x/24 seconds to stop, during which time the average speed of the car is x/2 feet per second. If the car travels 165 feet from the time the driver saw the red light to the time it comes to a complete stop, which of the following equations can be used to find the value of x?
A) x^2 + 48x − 3,960 B) x^2 + 48x − 7,920 C) x^2 + 72x − 3,960 D) x^2 + 72x − 7,920 QuestionMaizah bought a pair of pants and a briefcase at a department store. The sum of the prices before sales tax was $130.00. There was no sales tax on the pants and a 9% sales tax on the briefcase. The total Maizah paid, including the sales tax, was $136.75. What was the price, in dollars, of the pants?
Question2y + 6x = 3
y + 3x = 2 How many solutions (x, y) are there to the system of equations above? A) Zero B) One C) Two D) More than two QuestionA voter registration drive was held in Town Y. The number of voters, V, registered T days after the drive began can be estimated by the equation V = 3,450 + 65T. What is the best interpretation of the number 65 in this equation?
A) The number of registered voters at the beginning of the registration drive B) The number of registered voters at the end of the registration drive C) The total number of voters registered during the drive D) The number of voters registered each day during the drive QuestionThe stratosphere is the layer of the Earth’s atmosphere that is more than 10 kilometers (km) and less than 50 km above the Earth’s surface. Which of the following inequalities describes all possible heights x, in km, above the Earth’s surface that are in the stratosphere?
A) x + 10 < 50 B) x − 10 < 50 C) x + 30 < 20 D) x − 30 < 20 Question:If f(x) = 2x + 2 is a linear function, which of the following is true for 4f(x)?
A) The slope is four times steeper than f(x). B) The slope is four times less steep than f(x). C) All values of x are four times greater than f(x) for the same values of y. D) The slope changes, but the yintercept remains the same as f(x). Question:
Given a polynomial p(x), the value of p(3) = 2.
Which of the following must be true for p(x)? (A) x  5 is a factor of p(x). (B) x  2 is a factor of p(x). (C) x + 2 is a factor of p(x). (D) The remainder when p(x) is divided by x  3 is 2. Rationalize and Simplify the Given Expressions:
Problem:Only tenth, eleventh, and twelfthgrade students attend Washington High School. The ratio of tenth graders to the school’s total student population is 86:255, and the ratio of eleventh graders to the school’s total student population is 18:51. If 1 student is chosen at random from the entire school, which grade is that student most likely to be in?
Problem:
Which of the following is a rational number?
\[\sqrt2\]
\[\sqrt{\pi}\]
\[\sqrt7\]
\[\frac{\sqrt{5}}{\sqrt{25}}\]
\[\frac{\sqrt{64}}{\sqrt{49}}\]
Problem:The first term is 1 in the geometric sequence 1, −3, 9, −27, .... What is the SEVENTH term of the geometric sequence?
A. −243 B. 0−30 C. 081 D. 189 E. 729 Problem:Justine spends $122 to create a lemonade stand. If she sells p cups of lemonade at $2.50 per cup, which of the following expressions represents her profits after expenses?
A. p + 122 B. 2.5  p C. 2.5p  122 D. p  122
Problem: What is the value of
Note: i = sqrt(1)
A. i B. 1 C. i D. 1 E. sqrt(i) 
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2018
Categories
All
