implement #span and #primes