human
Composite numbers with digit sum 1 | Function that returns true if number n is a composite number.
Corner cases.
This is checked so that we can skip middle five numbers in below loop.
Function that returns true if the eventual digit sum of number nm is 1.
Loop till the sum is not single digit number.
Intitialize the sum as zero.
Find the sum of digits.
If sum is eventually 1.
Function to print the required numbers from the given range.
If i is one of the required numbers.
Driver code"
Solution in Python:
 What is a code to composite numbers with digit sum 1 and the other steps required?
assistant
#Here is code to composite numbers with digit sum 1 and the other steps required.
 def isComposite ( n ) :
	if ( n <= 1 ) :
		return False
	if ( n <= 3 ) :
		return False
	if ( n % 2 == 0 or n % 3 == 0 ) :
		return True
	i = 5
	while ( i * i <= n ) :
		if ( n % i == 0 or n % ( i + 2 ) == 0 ) :
			return True
		i = i + 6
	return False
def isDigitSumOne ( nm ) :
	while ( nm > 9 ) :
		sum_digit = 0
		while ( nm != 0 ) :
			digit = nm % 10
			sum_digit = sum_digit + digit
			nm = nm // 10
		nm = sum_digit
	if ( nm == 1 ) :
		return True
	else :
		return False
def printValidNums ( m , n ) :
	for i in range ( m , n + 1 ) :
		if ( isComposite ( i ) and isDigitSumOne ( i ) ) :
			print ( i , end = " ▁ " )
l = 10
r = 100
printValidNums ( m , n )