def sundaram(A, B):
	"""
	Sieve of Sundaram

	Generates the list of primes between A and B (both inclusive)
	Algorithm: https://en.wikipedia.org/wiki/Sieve_of_Sundaram
	Time Complexity: O(B log B)
	Space Complexity: O(B)

	:return: List of prime numbers
	:rtype: List[int]
	"""

	# Get new limit
	N = int((B-2)/2)
	# Mark all as False
	not_primes = [False] * (N+1)

	for i in range(1, N+1):
		j = i
		while i+j+2*i*j <= N:
			not_primes[i+j+2*i*j] = True
			j += 1

	if A<=2:
		return [2]+[2*p+1 for p in range(1, N+1) if not_primes[p]==False and (2*p+1)>=A and (2*p+1)<=B]
	return [2*p+1 for p in range(1, N+1) if not_primes[p]==False and (2*p+1)>=A and (2*p+1)<=B]