
"""simple docstring"""



from __future__ import annotations

import math






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					int						):






							"""simple docstring"""



							if 1 < number < 4:
														# 2 and 3 are primes
														return True
							elif number < 2 or number % 2 == 0 or number % 3 == 0:
														# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
														return False

							# All primes number are in format of 6k +/- 1
							for i in range(5     ,  int(math.sqrt(SCREAMING_SNAKE_CASE						) + 1						)     ,  6						):
														if number % i == 0 or number % (i + 2) == 0:
																					return False
							return True


_snake_case          =						[num for num in range(3, 1_0_0_0_0_1, 2) if not is_prime(num)]






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					int						):






							"""simple docstring"""



							if not isinstance(SCREAMING_SNAKE_CASE     ,  SCREAMING_SNAKE_CASE						):
														raise ValueError('n must be an integer'						)
							if n <= 0:
														raise ValueError('n must be >= 0'						)

							_lowerCAmelCase  	=			[]
							for num in range(len(SCREAMING_SNAKE_CASE						)						):
														_lowerCAmelCase  	=			0
														while 2 * i * i <= odd_composites[num]:
																					_lowerCAmelCase  	=			odd_composites[num] - 2 * i * i
																					if is_prime(SCREAMING_SNAKE_CASE						):
																												break
																					i += 1
														else:
																					list_nums.append(odd_composites[num]						)
																					if len(SCREAMING_SNAKE_CASE						) == n:
																												return list_nums

							return []






def 	__snake_case  (    ):






							"""simple docstring"""



							return compute_nums(1						)[0]


if __name__ == "__main__":
	print(f'{solution() = }')








"""simple docstring"""



from pathlib import Path

import numpy as np
from PIL import Image






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					np.ndarray						):






							"""simple docstring"""



							_lowerCAmelCase	,		_lowerCAmelCase	,		_lowerCAmelCase  	=			rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
							return 0.29_89 * r + 0.58_70 * g + 0.11_40 * b






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					np.ndarray						):






							"""simple docstring"""



							return (gray > 127) & (gray <= 255)






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					np.ndarray     ,  SCREAMING_SNAKE_CASE:					np.ndarray						):






							"""simple docstring"""



							_lowerCAmelCase  	=			np.zeros_like(SCREAMING_SNAKE_CASE						)
							_lowerCAmelCase  	=			np.zeros(
							    (image.shape[0] + kernel.shape[0] - 1, image.shape[1] + kernel.shape[1] - 1)						)

							# Copy image to padded image
							_lowerCAmelCase  	=			image

							# Iterate over image & apply kernel
							for x in range(image.shape[1]						):
														for y in range(image.shape[0]						):
																					_lowerCAmelCase  	=			(
																					    kernel * image_padded[y : y + kernel.shape[0], x : x + kernel.shape[1]]
																					).sum()
																					_lowerCAmelCase  	=			int(summation > 0						)
							return output


if __name__ == "__main__":
	# read original image
	_snake_case          =						Path(__file__).resolve().parent / '''image_data''' / '''lena.jpg'''
	_snake_case          =						np.array(Image.open(lena_path))
	# kernel to be applied
	_snake_case          =						np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
	_snake_case          =						dilation(gray_to_binary(rgb_to_gray(lena)), structuring_element)
	# Save the output image
	_snake_case          =						Image.fromarray(output).convert('''RGB''')
	pil_img.save('''result_dilation.png''')






