To find first N prime numbers in python

前端 未结 29 1909
醉梦人生
醉梦人生 2020-11-28 06:56

I am new to the programming world. I was just writing this code in python to generate N prime numbers. User should input the value for N which is the total number of prime n

29条回答
  •  有刺的猬
    2020-11-28 07:52

    This might help:

    def in_prime(n):
        p=True
        i=2
        if i**2<=n:
            if n%i==0:
                p=False
                break
        if (p):
            return n
    

提交回复
热议问题