human
Subarray of size K with prime sum | Generate all prime numbers in the range [ 1 , 1000000 ].
Set all numbers as prime initially.
Mark 0 and 1 as non - prime.
If current element is prime.
Mark all its multiples as non - prime.
Function to prthe subarray whose sum of elements is prime.
Store the current subarray of size K.
Calculate the sum of first K elements.
Check if currSum is prime.
Store the start and last index of subarray of size K.
Iterate over remaining array.
Check if currSum.
Driver Code"
Solution in Python:

=====
What is a code to subarray of size K with prime sum and the other steps required?
assistant
#Here is code to subarray of size K with prime sum and the other steps required.
 def sieve ( prime ) :
	for i in range ( 1000000 ) :
		prime [ i ] = True
	prime [ 0 ] = prime [ 1 ] = False
	for i in range ( 2 , 1000 + 1 ) :
		if ( prime [ i ] ) :
			for j in range ( i * i , 1000000 , i ) :
				prime [ j ] = False
	return prime
def subPrimeSum ( N , K , arr , prime ) :
	currSum = 0
	for i in range ( 0 , K ) :
		currSum += arr [ i ]
	if ( prime [ currSum ] ) :
		for i in range ( K ) :
			print ( arr [ i ] , end = " ▁ " )
		return
	st = 1
	en = K
	while ( en < N ) :
		currSum += arr [ en ] - arr [ st - 1 ]
		if ( prime [ currSum ] ) :
			for i in range ( st , en + 1 ) :
				print ( arr [ i ] , end = " ▁ " )
			return
		en += 1
		st += 1
if __name__ == ' _ _ main _ _ ' :
	arr = [ 20 , 7 , 5 , 4 , 3 , 11 , 99 , 87 , 23 , 45 ]
	K = 4
	N = len ( arr )
	prime = [ False ] * 1000000
	prime = sieve ( prime )
	subPrimeSum ( N , K , arr , prime )