P8207 [THUPC 2022 Preliminary] Least Common Multiple Tree

Background

It is said that some people dislike problem statements that are too long.

Description

For any $V \subset \mathbb{N}^*$ with $|V| < +\infty$, construct an undirected complete graph $G=(V,E)$, where the edge weight of $(u, v)$ is the least common multiple $\mathrm{lcm}(u, v)$ of $u$ and $v$. Call the minimum spanning tree of $G$ the least common multiple tree of $V$ (LCT, Lowest Common Tree). Now given $L, R$, please find the least common multiple tree $LCT(V)$ for $V = \{L, L+1, \cdots, R\}$.

Input Format

The input contains only one line, with two positive integers $L, R$.

Output Format

Output one positive integer, representing the sum of edge weights of $LCT(V)$.

Explanation/Hint

【Sample Explanation】 One possible set of edges in a least common multiple tree is $(3, 4), (3, 5), (3, 6), (3, 7), (4, 8), (3, 9), (5, 10), (3, 11), (3, 12)$. 【Constraints】 For $100\%$ of the testdata, it is guaranteed that $1 \le L \le R \le 10^6$, and $R-L \le 10^5$. Translated by ChatGPT 5