Hello everyone and welcome to this video lecture.
In this video lecture we are going to see how to bring these series of prime numbers from two to hundred.
So let us get started.
So say that lower equals to two and upper equals two hundred.
So it is within this range we are going to find out all these prime numbers.
OK.
So just say that for num been at range lower comma a perplexed one plus one.
OK.
So it is going to be read through all the numbers between two hundred.
So we have kept it a part plus one because it had we just kept it up.
But OK.
It wouldn't have actually taken us through 100 OK.
It would have just typed 99.
It says that for num in range lower comma upper plus one.
And let us see the logic.
OK.
So this is double for loop.
Ok so for I in range of two comma num OK.
So we are referring to this variable here.
OK.
So what we are doing is essentially doing is that we are trying to divide that number with all the earlier
numbers.
So if it is divisible by any number earlier so if it is divisible if the more of that is zero then break
it.
Else but in num.
So if that number is not divisible by any of the numbers earlier then that number is prime number because
we know the definition of prime number.
So the prime number is the number which is divisible by either itself or by one.
So it is not divisible by any number in between itself and 1.
So this is how we define the logic of prime numbers.
So we know that there are two types of number.
One is composite number and prime number composite numbers are the numbers which can be divided by one
themselves.
And many other numbers in between prime numbers cannot be divided by any number in between one n themselves.
So let's say this scored and executed so let us say.
Okay and let us go to the directory and see which that's 0 7.
But I coincidentally 0 7 is also a prime number.
We are just going to see that here in the output.
Yes.
As you can see it has printed all these prime numbers between one two hundred so it is two three five
and seven as I have told you already.
Eleven 13 17 1923 29 31 37.
And all the way up to 97.
So if you pay attention that these numbers are either divisible by themselves or one and they are not
divisible by any number in between that range.
So this is how we can print the list of prime numbers between any given range.
So you can even just see 10000 and it is going to print all the prime numbers between two to 10000
okay.
It is going to take quite a while actually to print all the prime numbers between 1 to 10000.
But we are ready to wait so let us resize the window mean right so it is printing all the prime numbers
between 1 to 1000.
One by one.
So it seems that there are many many prime numbers
OK.
Now we add up to eight
nine.
And it should stop executing at any moment.
OK.
So these are all prime numbers and these numbers cannot be divided by any number except the one and
themselves
so we have what many many prime numbers between 1 and 1000 one in 10000.
So this is how we can determine if a given number is prime.
And we can even find out the list of all the prime numbers between any two given numbers.
So thanks a lot for watching this video lecture.
Do let me know if you have any questions related to the logic or the theory of prime numbers.
Thanks a lot.
Once again for watching this video and we will meet each other again in the next video lecture.