Problem

Source: Greece National Olympiad 2022, Problem 2

Tags: number theory, Divisors



Let $n>4$ be a positive integer, which is divisible by $4$. We denote by $A_n$ the sum of the odd positive divisors of $n$. We also denote $B_n$ the sum of the even positive divisors of $n$, excluding the number $n$ itself. Find the least possible value of the expression $$f(n)=B_n-2A_n,$$for all possible values of $n$, as well as for which positive integers $n$ this minimum value is attained.