00:01
For this question, i want to find, given an input, i want to write the program that accepts the value of n as an input, and it determines if the value is prime.
00:16
We need to get an input from the, let's write some pseudocode first of all.
00:20
We need to get the input from the user.
00:24
So i can just get the input, and that's going to be n.
00:31
The next step is going to be, we need to check if n is greater than two.
00:37
Because we don't have any prime numbers less than two.
00:40
So if n is greater than two, we, if n is not greater than two, we want to close the program.
00:53
Let's actually print, let's actually print something saying n should be greater than two.
01:04
So let's flip this around.
01:07
If n is not greater than two, we print n should be greater than two.
01:26
Then on the else, we're going to have our logic.
01:30
This is for if n is greater than or equal to two.
01:38
But of course we need a for loop, because we're going to be checking multiple numbers until we get to the squared.
01:43
So for, i'm in python syntax.
01:52
This is going to be for i in range, roughly.
02:00
We want to go from two, obviously, to the square root of n.
02:11
We need to have this as an integer, right? because square root of n could be literally anything.
02:17
It could be fractional.
02:20
It could be also be an integer.
02:23
So we need to truncate this.
02:25
So we can just type cast on integer.
02:28
That's going to truncate it.
02:33
So let's take a small example.
02:36
Say we want to find if three is an, want to find if three is a, or let's go something like five.
02:44
If five is a prime number.
02:47
So two and square root of five.
02:50
Square root of five is somewhere around 2 .8 or 2 .7, i think...