
"""simple docstring"""





import math
from collections.abc import Generator







def       __a	(						__lowerCamelCase    ):
   UpperCAmelCase_   :   Generator     	=       (i for i in range(1,						(max_n + 1)    ))
   for i in (n for n in numbers if n > 1):
      for j in range(2,						__lowerCamelCase    ):
         if (i % j) == 0:
            break
      else:
         yield i







def       __a	(						__lowerCamelCase    ):
   UpperCAmelCase_   :   Generator     	=       (i for i in range(1,						(max_n + 1)    ))
   for i in (n for n in numbers if n > 1):
      # only need to check for factors up to sqrt(i)
      UpperCAmelCase_   :   Optional[int]     	=       int(math.sqrt(__lowerCamelCase    )    ) + 1
      for j in range(2,						__lowerCamelCase    ):
         if (i % j) == 0:
            break
      else:
         yield i







def       __a	(						__lowerCamelCase    ):
   UpperCAmelCase_   :   Generator     	=       (i for i in range(1,						(max_n + 1),						2    ))
   # It's useless to test even numbers as they will not be prime
   if max_n > 2:
      yield 2  # Because 2 will not be tested, it's necessary to yield it now
   for i in (n for n in numbers if n > 1):
      UpperCAmelCase_   :   Any     	=       int(math.sqrt(__lowerCamelCase    )    ) + 1
      for j in range(3,						__lowerCamelCase,						2    ):
         # As we removed the even numbers, we don't need them now
         if (i % j) == 0:
            break
      else:
         yield i







def       __a	(						):
   from timeit import timeit

   UpperCAmelCase_   :   List[str]     	=       "from __main__ import slow_primes, primes, fast_primes"
   print(timeit("slow_primes(1_000_000_000_000)",						setup=__lowerCamelCase,						number=100_0000    )    )
   print(timeit("primes(1_000_000_000_000)",						setup=__lowerCamelCase,						number=100_0000    )    )
   print(timeit("fast_primes(1_000_000_000_000)",						setup=__lowerCamelCase,						number=100_0000    )    )


if __name__ == "__main__":
    _a									=				int(input('Calculate primes up to:\n>> ').strip())
    for ret in primes(number):
        print(ret)
    benchmark()




"""simple docstring"""





import math
from timeit import timeit







def       __a	(						__lowerCamelCase    ):
   UpperCAmelCase_   :   Tuple     	=       0
   UpperCAmelCase_   :   Any     	=       abs(__lowerCamelCase    )
   while True:
      UpperCAmelCase_   :   Optional[int]     	=       n // 10
      digits += 1
      if n == 0:
         break
   return digits







def       __a	(						__lowerCamelCase    ):
   return 1 if n == 0 else math.floor(math.log(abs(__lowerCamelCase    ),						10    ) + 1    )







def       __a	(						__lowerCamelCase    ):
   return len(str(abs(__lowerCamelCase    )    )    )







def       __a	(						):
   from collections.abc import Callable

   def benchmark_a_function(__lowerCamelCase,						__lowerCamelCase    ) -> None:
      UpperCAmelCase_   :   Optional[Any]     	=       f"""{func.__name__}({value})"""
      UpperCAmelCase_   :   Optional[int]     	=       timeit(f"""__main__.{call}""",						setup="import __main__"    )
      print(f"""{call}: {func(__lowerCamelCase    )} -- {timing} seconds"""    )

   for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
      for func in (num_digits, num_digits_fast, num_digits_faster):
         benchmark_a_function(__lowerCamelCase,						__lowerCamelCase    )
      print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()


