


'''simple docstring'''





from __future__ import annotations

from math import ceil, floor, sqrt





def __UpperCAmelCase       (		__A = 2_0_0_0_0_0_0			)						->					int:



       '''simple docstring'''





       UpperCAmelCase__										=     [0]
       UpperCAmelCase__										=     4_2

       for idx in range(1 ,						ceil(sqrt(target * 2			) * 1.1			)			):
              triangle_numbers.append(triangle_numbers[-1] + idx			)

       # we want this to be as close as possible to target
       UpperCAmelCase__										=     0
       # the area corresponding to the grid that gives the product closest to target
       UpperCAmelCase__										=     0
       # an estimate of b, using the quadratic formula
       UpperCAmelCase__										=     4_2
       # the largest integer less than b_estimate
       UpperCAmelCase__										=     4_2
       # the largest integer less than b_estimate
       UpperCAmelCase__										=     4_2
       # the triangle number corresponding to b_floor
       UpperCAmelCase__										=     4_2
       # the triangle number corresponding to b_ceil
       UpperCAmelCase__										=     4_2

       for idx_a, triangle_a in enumerate(triangle_numbers[1:] ,						1			):
              UpperCAmelCase__										=     (-1 + sqrt(1 + 8 * target / triangle_a			)) / 2
              UpperCAmelCase__										=     floor(__A			)
              UpperCAmelCase__										=     ceil(__A			)
              UpperCAmelCase__										=     triangle_numbers[b_floor]
              UpperCAmelCase__										=     triangle_numbers[b_ceil]

              if abs(target - triangle_b_first_guess * triangle_a			) < abs(
                  target - best_product			):
                     UpperCAmelCase__										=     triangle_b_first_guess * triangle_a
                     UpperCAmelCase__										=     idx_a * b_floor

              if abs(target - triangle_b_second_guess * triangle_a			) < abs(
                  target - best_product			):
                     UpperCAmelCase__										=     triangle_b_second_guess * triangle_a
                     UpperCAmelCase__										=     idx_a * b_ceil

       return area


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









from __future__ import annotations





def __UpperCAmelCase       (		__A			)						->					list[int]:



       '''simple docstring'''





       UpperCAmelCase__										=     [True] * limit
       UpperCAmelCase__										=     False
       UpperCAmelCase__										=     False
       UpperCAmelCase__										=     True

       for i in range(3 ,						int(limit**0.5 + 1			) ,						2			):
              UpperCAmelCase__										=     i * 2
              while index < limit:
                     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       (		__A = 1_0_0_0_0_0_0			)						->					int:



       '''simple docstring'''





       UpperCAmelCase__										=     prime_sieve(__A			)
       UpperCAmelCase__										=     0
       UpperCAmelCase__										=     0

       for i in range(len(__A			)			):
              for j in range(i + length ,						len(__A			)			):
                     UpperCAmelCase__										=     sum(primes[i:j]			)
                     if sol >= ceiling:
                            break

                     if sol in primes:
                            UpperCAmelCase__										=     j - i
                            UpperCAmelCase__										=     sol

       return largest


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





