this is too complex . Try this instead n=int(input('enter the number range')) for i in range(2,n+1,1): for j in range(2,i,1): if i%j==0: break else: print(i)
def count_primes(initial,final): numberOfPrimes=0 for _ in range(initial,final+1): if _==1: continue if _ in [2,3,5,7] or (_%2 !=0 and _%3 !=0 and _%5 !=0 and _%7 !=0): print(_) numberOfPrimes +=1 return f"No. of prime numbers are {numberOfPrimes}"
When the interval from start to end is very large, like in lakhs of numbers, then this program will take more time to compute. In that case, I came to know that the fastest method may be Sieve Of Eratosthenes method. Can you please explain this same program using Sieve of Eratosthenes method?
I am even getting 0 or 1 while initializing the start variable with the value 0 or 1 as per the given code in the video, as both are not prime numbers ,so the code is missing some statements,so please rectify that!!.
start is taken from 1, it also includes 1 but 1 is not a prime number
use if(i>1):
print (i)
very well explained..thankyou so much
Welcome
Do like share and subscribe
this is too complex . Try this instead
n=int(input('enter the number range'))
for i in range(2,n+1,1):
for j in range(2,i,1):
if i%j==0:
break
else:
print(i)
This aint complex yet it lacks some statements.
def count_primes(initial,final):
numberOfPrimes=0
for _ in range(initial,final+1):
if _==1:
continue
if _ in [2,3,5,7] or (_%2 !=0 and _%3 !=0 and _%5 !=0 and _%7 !=0):
print(_)
numberOfPrimes +=1
return f"No. of prime numbers are {numberOfPrimes}"
Sir,in the code,why can't we give break statement immediately after if (i%j==0) is true.Why do we need to include flag=1?
Thank you sir
..
Welcome
Do like share and subscribe
When the interval from start to end is very large, like in lakhs of numbers, then this program will take more time to compute. In that case, I came to know that the fastest method may be Sieve Of Eratosthenes method. Can you please explain this same program using Sieve of Eratosthenes method?
Thank you sir ji
Welcome
Do like share and subscribe
How do I print prime numbers from 1 to 1000, in group of 10's? like 2,3,5,7,11,13,17,19,23,29, then another 10 prime numbers….in python
thank you
Welcome
Do like share and subscribe
Great
Thank You
Do like share and subscribe
What is meant by flag=0?
i also want to know
means they are prime number
It is used to count how many no
Count or flag is same😊
I am even getting 0 or 1 while initializing the start variable with the value 0 or 1 as per the given code in the video, as both are not prime numbers ,so the code is missing some statements,so please rectify that!!.
so simple
Thank You
Do like share and subscribe
Non prime numbers how to print
😂
Boss ,I need help .. my starting is 14 and ending is 16,,, there is no output .... But I need output as (no prime between the range ) ...
Prime number ka definition pta bhi h ki nhi
I want the code to show the available prime numbers, the number of prime numbers and the sum of all prime numbers
google cheko ra na bachha
evad pedthad anukunav ila adigite
i want the next prime number to be printed plz help
Sir what if the start value is 2
(Get the range from the user)... Whats the range?
get the range from user , :
so only we are using that input step on start and end point
I want comma in between numbers. What can I do
Thank you
",".join(myList)
myList is your list of all numbers
why is my program not working??!!
This one lacks some statements
How to sum all the prime numbers what will we get in results
@@MaheshHuddar thnq sir for replying to me.....I will wait for your video
@@MaheshHuddar sir ...did you uploaded the video
🥺
Thank you