human
Check whether factorial of N is divisible by sum of first N natural numbers | Function to check whether a number is prime or not ..
Count variable to store the number of factors of 'num.
Counting the number of factors.
If number is prime return true.
Function to check for divisibility.
if ' n ' equals 1 then divisibility is possible.
Else check whether ' n + 1' is prime or not.
If ' n + 1' is prime then ' n ! ' is not divisible by 'n*(n+1)/2.
else divisibility occurs.
Test for n = 3.
Test for n = 4"
Solution in Python:
 ... What is a code to check whether factorial of N is divisible by sum of first N natural numbers and the other steps required?
assistant
#Here is code to check whether factorial of N is divisible by sum of first N natural numbers and the other steps required.
 def is_prime ( num ) :
'
	count = 0
	for i in range ( 1 , num + 1 ) :
		if i * i > num :
			break
		if ( ( num ) % i == 0 ) :
			if ( i * i != ( num ) ) :
				count += 2
			else :
				count += 1
	if ( count == 2 ) :
		return True
	else :
		return False
def is_divisible ( n ) :
	if ( n == 1 ) :
		return " YES "
	else :
'
	if ( is_prime ( n + 1 ) ) :
		return " NO "
	else :
		return " YES "
n = 3
print ( is_divisible ( n ) )
n = 4
print ( is_divisible ( n ) )