The Sieve of Eratosthenes (sieve)

8 teams scored 325 points on this task, for a maximum score of 50, an average score of 41 and a median score of 35.

Highlights

  1. Galileo Galilei, Trento is the institute with the most points (50).
  2. Emilia-Romagna is the region with the most points (120).

Statement

Giorgio is playing with the Sieve of Eratosthenes, one of the most ancient algorithms of all times. This algorithm starts with a row containing all natural numbers from 2 to M (inclusive), then repeatedly selects the smallest non-selected number remaining in the row, erasing every multiple of it. At the end of the process, only prime numbers will have survived in the row! Giorgio is trying to apply a similar idea, but with a few differences. Firstly, some numbers are missing from the starting row, which contains only N numbers (each of them between 2 and M), in increasing order V_0, …, V_N-1. Secondly, every time Giorgio selects a number, he erases not only the multiples of it but also its divisors and the number itself. As in the original algorithm, Giorgio keeps selecting numbers from the row (and erasing accordingly), but he doesn't have to select numbers in increasing order. What is the minimum amount of numbers that must be selected to eliminate all the numbers?