human
Sum of first N natural numbers which are not powers of K | Function to return the sum of first n natural numbers which are not positive powers of k.
sum of first n natural numbers.
subtract all positive powers of k which are less than n.
next power of k.
Driver code"
Solution in Python:
 What is a code to sum of first N natural numbers which are not powers of K and the other steps required?
assistant
#Here is code to sum of first N natural numbers which are not powers of K and the other steps required.
 def find_sum ( n , k ) :
	total_sum = ( n * ( n + 1 ) ) // 2
	power = k
	while power <= n :
		total_sum -= power
		power *= k
	return total_sum
n = 11 ; k = 2
print ( find_sum ( n , k ) )