The goal is to find the date at which the sum of ages of a group of people will reach a certain number.
Though I seem to have found an approximative solution, some issues remains, that I don't know how to fix.
- Let $m$ be the number of individuals in the group: $m\in\mathbb{N}^*$
- Let $i$ be an index assigned to each individual: $i\in\mathbb{N}^*,i\leq{m}$
- Let $a_i$ be the date at which the $i$th individual was born: $\forall{i},a_i\in\mathbb{Q}_+$
- Let $\lfloor{a_i}\rfloor$ be the year of birth and $\{a_i\}$ be the anniversary date regardless of the year: $a_i=\lfloor{a_i}\rfloor+\{a_i\}$
- Let's assume that individuals are sorted by their anniversaries dates: $\forall{i}<m, \{a_i\}\leq\{a_{i+1}\}$
- Let $x$ be the date we are looking for: $x\in\mathbb{Q}_{+},x=\lfloor{x}\rfloor+\{x\}$
- We are not looking for any date, but an anniversary date: $\{x\}\in\bigcup_{i=1}^{m}\left\{\{a_{i}\}\right\}$
- Finally, let $n$ be the sum of all individuals ages: $n\in\mathbb{N}^*$
We expect the sum of all individual ages to be $n$:
$$ n=\sum_{i=1}^m\lfloor{x-a_{i}}\rfloor $$
At this point, I have to point out two flaws already:
- Some individuals may be born at the same date, making it impossible for the ages sum to reach $n$ exactly (skiping from below $n$ to over $n$).
- I didn't address the issue of bisextile years.
We can take out the years:
$$ n=\sum_{i=1}^m\lfloor{x}\rfloor-\sum_{i=1}^m\lfloor{a_{i}}\rfloor+\sum_{i=1}^m\lfloor\{x\}-\{a_{i}\}\rfloor\\ n=m\lfloor{x}\rfloor-\sum_{i=1}^m\lfloor{a_{i}}\rfloor+\sum_{i=1}^m\lfloor\{x\}-\{a_{i}\}\rfloor $$
- Given that $\{x\}$ is one of the $\{a_i\}$'s, we can let $j$ be such as: $j\in\mathbb{N}^*,j<m,\{a_j\}=\{x\}$
This allows us to break down the fractionnal parts sum into two sets:
$$ n=m\lfloor{x}\rfloor -\sum_{i=1}^m\lfloor{a_{i}}\rfloor +\sum_{i=1}^j\lfloor\{a_j\}-\{a_{i}\}\rfloor +\sum_{i=j+1}^m\lfloor\{a_j\}-\{a_{i}\}\rfloor $$
Until $j$, the term of the sum is:
$$ \forall i\leq j, \begin{cases} \{a_{i}\}\leq\{a_j\}\\ \{a_j\}<1 \end{cases} \Longrightarrow 0\leq\{a_j\}-\{a_{i}\}<1 \Longrightarrow \lfloor\{a_j\}-\{a_{i}\}\rfloor=0 $$
After $j$, the term of the sum is:
$$ \forall i>j, \begin{cases} \{a_{i}\}\geq\{a_j\}\\ \{a_i\}\geq0 \end{cases} \Longrightarrow -1\leq\{a_j\}-\{a_{i}\}\leq0 \Longrightarrow \lfloor\{a_j\}-\{a_{i}\}\rfloor=-1 $$
Note: I assume here that $\{a_j\}-\{a_{i}\}<0$ though $\{a_j\}-\{a_{i}\}\leq0$, as per the "same date anniversary" remark before.
Now we can get rid of the fractionnal parts:
$$ n=m\lfloor{x}\rfloor -\sum_{i=1}^m\lfloor{a_{i}}\rfloor +\sum_{i=1}^j0 +\sum_{i=j+1}^m{-1} \\ n=m\lfloor{x}\rfloor -\sum_{i=1}^m\lfloor{a_{i}}\rfloor -(m-(j+1)) $$
And isolate $j$ to find $x$
$$ j =n -m\lfloor{x}\rfloor +\sum_{i=1}^m\lfloor{a_{i}}\rfloor +m -1 \\ \{x\}=\{a_j\},j\equiv\left( n +\sum_{i=1}^m\lfloor{a_{i}}\rfloor -1 \right)[m] \\ \lfloor{x}\rfloor =\frac{n +\sum_{i=1}^m\lfloor{a_{i}}\rfloor +m-j-1}{m} $$