human
Sum of digits written in different bases from 2 to n | def to calculate sum of digit for a given base.
Sum of digits.
Calculating the number ( n ) by taking mod with the base and adding remainder to the result and parallelly reducing the num value ..
returning the result.
def calling for multiple bases.
Driver code"
Solution in Python:
 ... What is a code to sum of digits written in different bases from 2 to n and the other steps required?
assistant
#Here is code to sum of digits written in different bases from 2 to n and the other steps required.
 def solve ( n , base ) :
	result = 0
	while ( n > 0 ) :
		remainder = n % base
		result = result + remainder
		n = int ( n / base )
	return result
def printSumsOfDigits ( n ) :
	for base in range ( 2 , n ) :
		print ( solve ( n , base ) , end = " ▁ " )
n = 8
printSumsOfDigits ( n )