#P4963. 美樱的颜料
美樱的颜料
Description
Miying has different kinds of paints, numbered from to . Each kind of paint can be used at most once. When she starts a painting, she may choose any one paint to use.
After that, each time Miying chooses a paint to use such that, after using paint , the (greatest common divisor) of the indices of all paints used so far is as large as possible, that is:
Let the set of indices of paints already used be . If $\ \exists\ i,\ j\notin A,\ i,\ j\in [1,\ n],\ gcd(A,\ i)>gcd(A,\ j)$, then paint cannot be chosen.
If there are multiple paints that satisfy the condition, Miying may choose any one of them. After each paint is used, Miying gains a happiness value equal to the of the indices of all paints used so far.
Now Miying wants to draw a painting using kinds of paints. What is the maximum possible sum of happiness values she can obtain?
Input Format
A single line with two positive integers , representing the number of kinds of paints and the number of paints Miying will use.
Output Format
Output one positive integer, the maximum happiness value Miying can obtain.
7 4
11
15 3
25
Hint
.
Constraints
Sample Explanation
Sample 1: 6 3 5 2 is an optimal solution. The happiness values obtained each time are 6 3 1 1.
Sample 2: 15 10 5 is an optimal solution. The happiness values obtained each time are 15 5 5.
Translated by ChatGPT 5
京公网安备 11011102002149号