How do I find a prime number using recursion in Python
问题 I have to find out whether number(N) is a prime or not using recursion, no loops are allowed. I've tried converting the usual code that uses a for loop to a recursive one, but it's not behaving the same. This function is included in another function, which is part of another function. only parameters a and N should be used and passed Here is my function. a=2 def is_prime(a,N): prime = True if N <=1: return else: if a >= N: return else: if N == 2: prime = True print(N) return elif (N % a) == 0