Let $a_i$, $i=1,2,...,n$ be non-negative real numbers and $\sum_{i=1}^na_i =1$. Find $\max S=\sum_{i\mid j}a_i a_j $.
Problem
Source: IV International Festival of Young Mathematicians Sozopol 2013, Theme for 10-12 grade
Tags: number theory, algebra, Sum