L3. Check if a Number if Prime or not | Maths Playlist

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

You don't need to count the factors. You can exit as soon as you discover a factor (that is not 1 or itself).
for (i = 2; i * i <= n; ++i) {
if ((n % i) == 0) {
return false;
}
}
return true;

psionl
Автор

import math
def isprime(n):
if n<=1:
return False
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False

return True

_bajpai
Автор

I'm interested, 😂🖐🏻 and I'm the first one cause of loving code

massmass
Автор

In for loop i should be initialize with 2 not 1 because if you initialize with 1 then it will count 1 as a Prime Number but 1 is not a prime number

diviniixx
Автор

Amazing sir another playlist pls keep your next play list on stacks and queues

beaware
Автор

Bhaiya next playlist on string problems please

ramdangi
Автор

Thanks a lot for helping us Bhai <3

manikanta
Автор

the 2nd if should be am is in the title

antonioradu
Автор

♥♥ please make new videos on trees and graphs

imran
Автор

waiting for stacks and queues playlist

seifyny
welcome to shbcf.ru