


'''simple docstring'''

lowerCamelCase							:       Union[str, Any]  						=     {
    '0': 1,
    '1': 1,
    '2': 2,
    '3': 6,
    '4': 24,
    '5': 120,
    '6': 720,
    '7': 5_040,
    '8': 40_320,
    '9': 362_880,
}

lowerCamelCase							:       Dict  						=     {145: 145}

lowerCamelCase							:       str  						=     {
    145: 0,
    169: 3,
    36_301: 3,
    1_454: 3,
    871: 2,
    45_361: 2,
    872: 2,
}

def _SCREAMING_SNAKE_CASE				(A	)	->	int:






       """simple docstring"""







       if n in CACHE_SUM_DIGIT_FACTORIALS:
              return CACHE_SUM_DIGIT_FACTORIALS[n]
       lowercase__				      =			sum(DIGIT_FACTORIALS[let] for let in str(A	)	)
       lowercase__				      =			ret
       return ret

def _SCREAMING_SNAKE_CASE				(A  ,			A = None	)	->	int:






       """simple docstring"""







       lowercase__				      =			previous or set()
       if n in CHAIN_LENGTH_CACHE:
              return CHAIN_LENGTH_CACHE[n]
       lowercase__				      =			sum_digit_factorials(A	)
       if next_number in previous:
              lowercase__				      =			0
              return 0
       else:
              previous.add(A	)
              lowercase__				      =			1 + chain_length(A  ,			A	)
              lowercase__				      =			ret
              return ret

def _SCREAMING_SNAKE_CASE				(A = 60  ,			A = 1_000_000	)	->	int:






       """simple docstring"""







       return sum(1 for i in range(1  ,			A	) if chain_length(A	) == num_terms	)


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








'''simple docstring'''

import math
import os

import cva
import numpy as np

lowerCamelCase							:       Optional[Any]  						=     2_5_5.0

def _SCREAMING_SNAKE_CASE				(A  ,			A	)	->	float:






       """simple docstring"""







       lowercase__				      =			np.mean((original - contrast) ** 2	)
       if mse == 0:
              return 100

       return 20 * math.logaa(PIXEL_MAX / math.sqrt(A	)	)

def _SCREAMING_SNAKE_CASE				()	->	None:






       """simple docstring"""







       lowercase__				      =			os.path.dirname(os.path.realpath(A	)	)
       # Loading images (original image and compressed image)
       lowercase__				      =			cva.imread(os.path.join(A  ,			'''image_data/original_image.png'''	)	)
       lowercase__				      =			cva.imread(os.path.join(A  ,			'''image_data/compressed_image.png'''	)  ,			1	)

       lowercase__				      =			cva.imread(os.path.join(A  ,			'''image_data/PSNR-example-base.png'''	)	)
       lowercase__				      =			cva.imread(
           os.path.join(A  ,			'''image_data/PSNR-example-comp-10.jpg'''	)  ,			1	)

       # Value expected: 29.73dB
       print('''-- First Test --'''	)
       print(f"PSNR value is {peak_signal_to_noise_ratio(A  ,			A	)} dB"	)

       # # Value expected: 31.53dB (Wikipedia Example)
       print('''\n-- Second Test --'''	)
       print(f"PSNR value is {peak_signal_to_noise_ratio(A  ,			A	)} dB"	)


if __name__ == "__main__":
 main()




