from dataclasses import dataclass
from typing import Tuple

import numpy as np
import torch


@dataclass
class 						lowercase    :
							lowercase__						:       torch.Tensor  # [batch_size x 3]
							lowercase__						:       torch.Tensor  # [batch_size x 3]
							lowercase__						:       torch.Tensor  # [batch_size x 3]
							lowercase__						:       torch.Tensor  # [batch_size x 3]
							lowercase__						:       int
							lowercase__						:       int
							lowercase__						:       float
							lowercase__						:       float
							lowercase__						:       Tuple[int]




							def 	__snake_case(						self   :					Optional[int]      )					->				Dict:



												'''simple docstring'''

												assert self.x.shape[0] == self.y.shape[0] == self.z.shape[0] == self.origin.shape[0]
												assert self.x.shape[1] == self.y.shape[1] == self.z.shape[1] == self.origin.shape[1] == 3
												assert len(self.x.shape      ) == len(self.y.shape      ) == len(self.z.shape      ) == len(self.origin.shape      ) == 2




							def 	__snake_case(						self   :					Any      )					->				Tuple:



												'''simple docstring'''

												return torch.from_numpy(np.array([self.width, self.height]	,							dtype=np.floataa      )      )




							def 	__snake_case(						self   :					Dict      )					->				Union[str, Any]:



												'''simple docstring'''

												return torch.from_numpy(np.array([self.x_fov, self.y_fov]	,							dtype=np.floataa      )      )




							def 	__snake_case(						self   :					Dict      )					->				torch.Tensor:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       torch.arange(self.height * self.width      )
												SCREAMING_SNAKE_CASE    			=       torch.stack(
												    [
												        pixel_indices % self.width,
												        torch.div(_UpperCamelCase	,							self.width	,							rounding_mode="trunc"      ),
												    ]	,							axis=1	,							)
												return coords




							@property
							def 	__snake_case(						self   :					List[Any]      )					->				Union[str, Any]:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE			,   *SCREAMING_SNAKE_CASE    			=       self.shape
												SCREAMING_SNAKE_CASE    			=       int(np.prod(_UpperCamelCase      )      )

												SCREAMING_SNAKE_CASE    			=       self.get_image_coords()
												SCREAMING_SNAKE_CASE    			=       torch.broadcast_to(coords.unsqueeze(0      )	,							[batch_size * inner_batch_size, *coords.shape]      )
												SCREAMING_SNAKE_CASE    			=       self.get_camera_rays(_UpperCamelCase      )

												SCREAMING_SNAKE_CASE    			=       rays.view(_UpperCamelCase	,							inner_batch_size * self.height * self.width	,							2	,							3      )

												return rays




							def 	__snake_case(						self   :					Dict	,							_UpperCamelCase   :					torch.Tensor      )					->				torch.Tensor:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE			,   *SCREAMING_SNAKE_CASE			,   SCREAMING_SNAKE_CASE    			=       coords.shape
												assert n_coords == 2
												assert batch_size == self.origin.shape[0]

												SCREAMING_SNAKE_CASE    			=       coords.view(_UpperCamelCase	,							-1	,							2      )

												SCREAMING_SNAKE_CASE    			=       self.resolution()
												SCREAMING_SNAKE_CASE    			=       self.fov()

												SCREAMING_SNAKE_CASE    			=       (flat.float() / (res - 1)) * 2 - 1
												SCREAMING_SNAKE_CASE    			=       fracs * torch.tan(fov / 2      )

												SCREAMING_SNAKE_CASE    			=       fracs.view(_UpperCamelCase	,							-1	,							2      )
												SCREAMING_SNAKE_CASE    			=       (
												    self.z.view(_UpperCamelCase	,							1	,							3      )
												    + self.x.view(_UpperCamelCase	,							1	,							3      ) * fracs[:, :, :1]
												    + self.y.view(_UpperCamelCase	,							1	,							3      ) * fracs[:, :, 1:]
												)
												SCREAMING_SNAKE_CASE    			=       directions / directions.norm(dim=-1	,							keepdim=_UpperCamelCase      )
												SCREAMING_SNAKE_CASE    			=       torch.stack(
												    [
												        torch.broadcast_to(self.origin.view(_UpperCamelCase	,							1	,							3      )	,							[batch_size, directions.shape[1], 3]      ),
												        directions,
												    ]	,							dim=2	,							)
												return rays.view(_UpperCamelCase	,							*_UpperCamelCase	,							2	,							3      )





							def 	__snake_case(						self   :					Dict	,							_UpperCamelCase   :					int	,							_UpperCamelCase   :					int      )					->				"DifferentiableProjectiveCamera":



												'''simple docstring'''

												assert width * self.height == height * self.width, "The aspect ratio should not change."
												return DifferentiableProjectiveCamera(
												    origin=self.origin	,							x=self.x	,							y=self.y	,							z=self.z	,							width=_UpperCamelCase	,							height=_UpperCamelCase	,							x_fov=self.x_fov	,							y_fov=self.y_fov	,							)





def 	__lowerCamelCase					(UpperCAmelCase__     :							int  ):
					SCREAMING_SNAKE_CASE    			=       []
					SCREAMING_SNAKE_CASE    			=       []
					SCREAMING_SNAKE_CASE    			=       []
					SCREAMING_SNAKE_CASE    			=       []
					for theta in np.linspace(0      , 2 * np.pi      , num=2_0  ):
										SCREAMING_SNAKE_CASE    			=       np.array([np.sin(UpperCAmelCase__  ), np.cos(UpperCAmelCase__  ), -0.5]  )
										z /= np.sqrt(np.sum(z**2  )  )
										SCREAMING_SNAKE_CASE    			=       -z * 4
										SCREAMING_SNAKE_CASE    			=       np.array([np.cos(UpperCAmelCase__  ), -np.sin(UpperCAmelCase__  ), 0.0]  )
										SCREAMING_SNAKE_CASE    			=       np.cross(UpperCAmelCase__      , UpperCAmelCase__  )
										origins.append(UpperCAmelCase__  )
										xs.append(UpperCAmelCase__  )
										ys.append(UpperCAmelCase__  )
										zs.append(UpperCAmelCase__  )
					return DifferentiableProjectiveCamera(
					    origin=torch.from_numpy(np.stack(UpperCAmelCase__      , axis=0  )  ).float()      , x=torch.from_numpy(np.stack(UpperCAmelCase__      , axis=0  )  ).float()      , y=torch.from_numpy(np.stack(UpperCAmelCase__      , axis=0  )  ).float()      , z=torch.from_numpy(np.stack(UpperCAmelCase__      , axis=0  )  ).float()      , width=UpperCAmelCase__      , height=UpperCAmelCase__      , x_fov=0.7      , y_fov=0.7      , shape=(1, len(UpperCAmelCase__  ))      , )





from __future__ import annotations

import math





def 	__lowerCamelCase							(UpperCAmelCase__     :							int  ):

					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(UpperCAmelCase__  ) + 1  )      , 6  ):
										if number % i == 0 or number % (i + 2) == 0:
															return False
					return True


_lowerCamelCase					:   Tuple							=		[num for num in range(3, 10_00_01, 2) if not is_prime(num)]





def 	__lowerCamelCase							(UpperCAmelCase__     :							int  ):
					if not isinstance(UpperCAmelCase__      , UpperCAmelCase__  ):
										raise ValueError("n must be an integer"  )
					if n <= 0:
										raise ValueError("n must be >= 0"  )

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

					return []





def 	__lowerCamelCase							():
					return compute_nums(1  )[0]


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




