

'''simple docstring'''

def     __magic_name__       ( A							)			->		str:
	snake_case							 =				1
	snake_case							 =				0
	snake_case							 =				1
	snake_case							 =				1
	snake_case							 =				3
	snake_case							 =				3
	snake_case							 =				limit
	snake_case							 =				0

	snake_case							 =				''
	while counter != decimal + 1:
		if 4 * q + r - t < n * t:
			result += str(A							)
			if counter == 0:
				result += "."

			if decimal == counter:
				break

			counter += 1
			snake_case							 =				1_0 * (r - n * t)
			snake_case							 =				((1_0 * (3 * q + r)) // t) - 1_0 * n
			q *= 1_0
			snake_case							 =				nr
		else:
			snake_case							 =				(2 * q + r) * l
			snake_case							 =				(q * (7 * k) + 2 + (r * l)) // (t * l)
			q *= k
			t *= l
			l += 2
			k += 1
			snake_case							 =				nn
			snake_case							 =				nr
	return result

def     __magic_name__       ( )			->		None:
	print(F'''{calculate_pi(5_0							) = }'''							)
	import doctest

	doctest.testmod()


if __name__ == "__main__":
						main()








'''simple docstring'''

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

def     __magic_name__       ( A							)			->		list[int]:

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

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

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

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


if __name__ == "__main__":
						import doctest

						doctest.testmod()





