LCM of numbers from 1 to 100
Answers
Answer:
First let us understand what LCM is all about.
LCM is a number which is divisible by any of the given numbers.
Take example of consecutive numbers from 1 to 10
The LCM will be 2^3 x 3^2 x 5 x 7 = 2520————(A)
Observe :
These are all Prime Numbers (2,3,5,7) and
The number which is the highest power of the prime number below 10 is taken eg 8 and 9 (ie 2^3 and 3^2)
On similar lines for calculating LCM of consecutive numbers from 1 to 20,
we will have to first to find which prime numbers’ highest power is appearing below 20, which is obviously 16 and 9, but 9 is below 10, hence we have to consider only 2^4 (which is greater than 10 but less than 20)
Hence the LCM of consecutive numbers from 1 to 20 will be
2^4 x 3^2 x 5 x 7 x 11 x 13 x 17 x 19 =23,27,92,560————(B)
When( B) is divided by (A), what we get will be the product of prime numbers between 10 and 20 and the 2 (which has number with increased power of prime numbers between 10 and 20)
So answer will be 2 x 11 x 13 x 17 x 19 = 92378
Now apply same logic to the given problem:
Find the prime numbers between 90 and 100. It is only 97
Is there any power of a prime number (means perfect square or cube ) appearing between 90 and 100. Answer is NO (100 is a square but not of a prime number)
Hence the answer to the given problem will be 97 without actually calculating.
I hope I have made it amply clear.
Step-by-step explanation:
This is the correct answer
Make the answer brilliant
Follow me
Answer: 69720375229712477164533808935312303556800
Step-by-step explanation:
You can find a similar problem on https://projecteuler.net/archives which is based around coding solutions to problems like these
as this seems impossible to do by hand i will outline the steps i took to code this - resulting in a command to find the lcm of any range of numbers - the actual method for finding this will probably be better explained by someone else here
- first create a function which finds the prime factors of a number
- second, a function that returns all the primes below your upper bound(100)(you may also need a function to check if a number is prime at this point)
- third, a function that returns a list of each of the numbers in your range(1-100) after they've been passed through the first function [1, 2, 3, [2, 2], 5, [2, 3]... etc]
finally, a function which takes each prime found in the second function, checks over the arrays found by the third function for the instance where the prime occurs most often(for 2 it would be in 64 -> 2x2x2x2x2x2) and then returns the prime to a new list that many times (2 would be added 6 times) then just multiply every number in that list and you have your answer