code: 
  
  
  from __future__ import annotations
  
  import math
  from itertools import permutations
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  bool:
  
  						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
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase = 7				)    ->  int:
  						_a     =			''.join(str(_UpperCAmelCase				) for i in range(1							,     n + 1				)				)
  						_a     =			[int(''.join(_UpperCAmelCase				)				) for i in permutations(_UpperCAmelCase							,     _UpperCAmelCase				)]
  						_a     =			[num for num in perm_list if is_prime(_UpperCAmelCase				)]
  						return max(_UpperCAmelCase				) if pandigitals else 0
  
  
  if __name__ == "__main__":
  		print(f"""{solution() = }""")
  
  
  
style_context: 
  
  
  import numpy as np
  import PIL
  import torch
  import torchvision.transforms as T
  import torchvision.transforms.functional as TF
  from PIL import Image
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase=256				)    ->  Dict:
  						_a     =			min(img.size				)
  
  						if s < target_image_size:
  												raise ValueError(f"""min dim for image {s} < {target_image_size}"""				)
  
  						_a     =			target_image_size / s
  						_a     =			(round(r * img.size[1]				), round(r * img.size[0]				))
  						_a     =			TF.resize(_UpperCAmelCase							,     _UpperCAmelCase							,     interpolation=PIL.Image.LANCZOS				)
  						_a     =			TF.center_crop(_UpperCAmelCase							,     output_size=2 * [target_image_size]				)
  						_a     =			torch.unsqueeze(T.ToTensor()(_UpperCAmelCase				)							,     0				)
  						return img
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  List[Any]:
  						_a     =			2.0 * x - 1.0
  						return x
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase=True							,     _UpperCAmelCase="RGB"				)    ->  Optional[Any]:
  						_a     =			x.detach().cpu()
  						if process:
  												_a     =			post_process_tensor(_UpperCAmelCase				)
  						_a     =			x.numpy()
  						if process:
  												_a     =			(255 * x).astype(np.uinta				)
  						_a     =			Image.fromarray(_UpperCAmelCase				)
  						if not x.mode == mode:
  												_a     =			x.convert(_UpperCAmelCase				)
  						return x
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  Optional[Any]:
  						_a     =			torch.clamp(_UpperCAmelCase							,     -1.0							,     1.0				)
  						_a     =			(x + 1.0) / 2.0
  						_a     =			x.permute(1							,     2							,     0				)
  						return x
  
  
  
  
  
  
  def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  str:
  						_a     =			post_process_tensor(x.squeeze()				)
  						return x.permute(2							,     0							,     1				).unsqueeze(0				)
  
  
  