Fleeting Medians
Problem 593
We define two sequences and :
mod where is the th prime number.
where denotes the floor function.
Then let be the median of elements through , inclusive. For example, and .
Let . For example, and .
Find . If the sum is not an integer, use to denote a half. Otherwise, use instead.