
'''simple docstring'''







from math import pow





def    UpperCAmelCase_						(__a :       Any					,      __a :       Optional[Any]					,      __a :       Optional[Any]					,      __a :       Optional[Any]					,      __a :       Optional[Any]					,      ):






   """simple docstring"""

   if current_sum == needed_sum:
      # If the sum of the powers is equal to needed_sum, then we have a solution.
      solutions_count += 1
      return current_sum, solutions_count

   _a							:      int     =  int(pow(__a					,      __a					)					)
   if current_sum + i_to_n <= needed_sum:
      # If the sum of the powers is less than needed_sum, then continue adding powers.
      current_sum += i_to_n
      _a,    _a							:      int     =  backtrack(
          __a					,      __a					,      current_number + 1					,      __a					,      __a					)
      current_sum -= i_to_n
   if i_to_n < needed_sum:
      # If the power of i is less than needed_sum, then try with the next power.
      _a,    _a							:      str     =  backtrack(
          __a					,      __a					,      current_number + 1					,      __a					,      __a					)
   return current_sum, solutions_count





def    UpperCAmelCase_						(__a :       Dict					,      __a :       Optional[Any]					):






   """simple docstring"""

   if not (1 <= needed_sum <= 1_0_0_0 and 2 <= power <= 1_0):
      raise ValueError(
          'Invalid input\n'
          'needed_sum must be between 1 and 1000, power between 2 and 10.'					)

   return backtrack(__a					,      __a					,      1					,      0					,      0					)[1]  # Return the solutions_count


if __name__ == "__main__":
  import doctest

  doctest.testmod()




"""simple docstring"""


from math import isqrt






def      __UpperCAmelCase       (      lowercase		):







  """simple docstring"""
  _UpperCAmelCase    			=   [True] * max_number
  for i in range(2 ,isqrt(max_number - 1		) + 1		):
    if is_prime[i]:
      for j in range(i**2 ,lowercase ,lowercase		):
        _UpperCAmelCase    			=   False

  return [i for i in range(2 ,lowercase		) if is_prime[i]]






def      __UpperCAmelCase       (      lowercase = 10**8		):







  """simple docstring"""
  _UpperCAmelCase    			=   calculate_prime_numbers(max_number // 2		)

  _UpperCAmelCase    			=   0
  _UpperCAmelCase    			=   0
  _UpperCAmelCase    			=   len(lowercase		) - 1
  while left <= right:
    while prime_numbers[left] * prime_numbers[right] >= max_number:
      right -= 1
    semiprimes_count += right - left + 1
    left += 1

  return semiprimes_count


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