#P8207. [THUPC 2022 初赛] 最小公倍树

[THUPC 2022 初赛] 最小公倍树

Background

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

Problem Description

For any VNV \subset \mathbb{N}^* with V<+|V| < +\infty, construct an undirected complete graph G=(V,E)G=(V,E), where the edge weight of (u,v)(u, v) is the least common multiple lcm(u,v)\mathrm{lcm}(u, v) of uu and vv. Call the minimum spanning tree of GG the least common multiple tree of VV (LCT, Lowest Common Tree).

Now given L,RL, R, please find the least common multiple tree LCT(V)LCT(V) for V={L,L+1,,R}V = \{L, L+1, \cdots, R\}.

Input Format

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

Output Format

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

3 12
126
6022 14076
66140507445
13063 77883
3692727018161
325735 425533
1483175252352926

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%100\% of the testdata, it is guaranteed that 1LR1061 \le L \le R \le 10^6, and RL105R-L \le 10^5.

Translated by ChatGPT 5