Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

next prime number in python

#add this code to your code and call "nextprime(number)"
def nextprime(n):
	prime=0
	n+=1
	for i in range(2,int(n**0.5)+2):
		if n%i==0:
			prime=0
			break
		else:
			prime=1
	if prime==1:
		print(n)
		return
	else:
		nextprime(n)
		return
 
PREVIOUS NEXT
Tagged: #prime #number #python
ADD COMMENT
Topic
Name
1+6 =