# Sieve of Eratosthenes

```class Solution:
def countPrimes(self, n: int) -> int:
if n < 3:
return 0

primes = [0, 0] + [1] * (n - 2)

for i in range(2, int(n ** 0.5) + 1):
if primes[i]:
primes[i * i: n: i] = [0] * len(primes[i * i: n: i])

return sum(primes)```

# Gaia

In Greek mythology, Gaia is the personification of the Earth and one of the Greek primordial deities.

Gaia is the ancestral mother of all life: the primal Mother Earth goddess. She is the immediate parent of Uranus (the sky), from whose sexual union she bore the Titans (themselves parents of many of the Olympian gods) and the Giants, and of Pontus (the sea), from whose union she bore the primordial sea gods.

Her equivalent in the Roman pantheon was Terra.

# Levithan

Leviathan, or The Matter, Forme and Power of a Common Wealth Ecclesiastical and Civil

# Binary Index Tree

```class BIT:
def __init__(self, n):
self.n = n + 1
self.sums = [0] * self.n

def update(self, i, delta):
while i < self.n:
self.sums[i] += delta
i += i & (-i)

def query(self, i):
res = 0
while i > 0:
res += self.sums[i]
i -= i & (-i)
return res```