


import math

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int    ):
					__UpperCamelCase   							=[True] * n
					__UpperCamelCase   							=False
					__UpperCamelCase   							=False
					__UpperCamelCase   							=True

					for i in range(3      ,					int(n**0.5 + 1    )      ,					2    ):
										__UpperCamelCase   							=i * 2
										while index < n:
															__UpperCamelCase   							=False
															__UpperCamelCase   							=index + i

					__UpperCamelCase   							=[2]

					for i in range(3      ,					_A      ,					2    ):
										if is_prime[i]:
															primes.append(_A    )

					return primes

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int = 99_99_66_66_33_33    ):
					__UpperCamelCase   							=math.floor(math.sqrt(_A    )    ) + 1_00
					__UpperCamelCase   							=prime_sieve(_A    )

					__UpperCamelCase   							=0
					__UpperCamelCase   							=0
					__UpperCamelCase   							=primes[prime_index]

					while (last_prime**2) <= limit:
										__UpperCamelCase   							=primes[prime_index + 1]

										__UpperCamelCase   							=last_prime**2
										__UpperCamelCase   							=next_prime**2

										# Get numbers divisible by lps(current)
										__UpperCamelCase   							=lower_bound + last_prime
										while upper_bound > current <= limit:
															matches_sum += current
															current += last_prime

										# Reset the upper_bound
										while (upper_bound - next_prime) > limit:
															upper_bound -= next_prime

										# Add the numbers divisible by ups(current)
										__UpperCamelCase   							=upper_bound - next_prime
										while current > lower_bound:
															matches_sum += current
															current -= next_prime

										# Remove the numbers divisible by both ups and lps
										__UpperCamelCase   							=0
										while upper_bound > current <= limit:
															if current <= lower_bound:
																				# Increment the current number
																				current += last_prime * next_prime
																				continue

															if current > limit:
																				break

															# Remove twice since it was added by both ups and lps
															matches_sum -= current * 2

															# Increment the current number
															current += last_prime * next_prime

										# Setup for next pair
										__UpperCamelCase   							=next_prime
										prime_index += 1

					return matches_sum


if __name__ == "__main__":
			print(solution())









import sys

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

_A			=						'python tqdm regex requests packaging filelock numpy tokenizers'.split()
if sys.version_info < (3, 7):
   pkgs_to_check_at_runtime.append('dataclasses')
if sys.version_info < (3, 8):
   pkgs_to_check_at_runtime.append('importlib_metadata')

for pkg in pkgs_to_check_at_runtime:
   if pkg in deps:
      if pkg == "tokenizers":
         # must be loaded here, or else tqdm check may fail
         from .utils import is_tokenizers_available

         if not is_tokenizers_available():
            continue  # not required, check version only if installed

      require_version_core(deps[pkg])
   else:
      raise ValueError(f"""can't find {pkg} in {deps.keys()}, check dependency_versions_table.py""")

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Union[str, Any]      ,					SCREAMING_SNAKE_CASE__      : Optional[int]=None    ):
     require_version(deps[pkg]      ,					SCREAMING_SNAKE_CASE__    )





