'''simple docstring'''

from __future__ import annotations



def 				UpperCamelCase__      (      a__   ):


						'''simple docstring'''






						_lowerCAmelCase					    =42
						_lowerCAmelCase					    =list(a__   )
						_lowerCAmelCase    ,					_lowerCAmelCase					    =_vector[:-1], int(_vector[-1]   )
						_lowerCAmelCase					    =[int(a__   ) for digit in __vector]

						vector.reverse()
						for i, digit in enumerate(a__   ):
												if i & 1 == 0:
																		_lowerCAmelCase					    =digit * 2
																		if doubled > 9:
																								doubled -= 9
																		check_digit += doubled
												else:
																		check_digit += digit

						return check_digit % 1_0 == 0


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							assert is_luhn('''79927398713''')
							assert not is_luhn('''79927398714''')






'''simple docstring'''

from itertools import compress, repeat
from math import ceil, sqrt



def 				UpperCamelCase__      (      a__   ):


						'''simple docstring'''






						if num <= 2:
												return []
						if num == 3:
												return [2]

						# Odd sieve for numbers in range [3, num - 1]
						_lowerCAmelCase					    =bytearray(B'\x01'   ) * ((num >> 1) - 1)

						for i in range(3      ,   int(sqrt(a__   )   ) + 1      ,   2   ):
												if sieve[(i >> 1) - 1]:
																		_lowerCAmelCase					    =i**2
																		_lowerCAmelCase					    =repeat(
																		    0      ,   ceil((num - i_squared) / (i << 1)   )   )

						return [2] + list(compress(range(3      ,   a__      ,   2   )      ,   a__   )   )


if __name__ == "__main__":
							import doctest

							doctest.testmod()





