Jaw-Dropping Set
Time limit1sMemory limit256 MB
For each n up to 1e9, find the maximum size of a subset of {1..n} with no element dividing another, then the minimum possible sum among such maximum-size subsets.
- Level
Medium6 of 10
- Topics
- Math, Number theory, Greedy, Combinatorics
- Solved
- No attempts yet
Problem
A subset of the set is called interesting if for any pair of different integers , neither divides nor divides .
An interesting subset is called amazing if it has the maximum cardinality among all interesting subsets.
Finally, an amazing subset is called jaw-dropping if it has the minimum sum of elements among all amazing subsets.
Given , find the sum of elements in a jaw-dropping subset of .
Input
The first line contains the integer (), the number of test cases.
Each of the next lines contains an integer ().
Output
Print lines with the answer for each test case.