Inspired by this problem by Brian Lie .
Find the minimum number of primes needed in a set (its cardinality) such that every positive integer less than or equal to 2018 can be expressed as a sum of some or all primes from this set, using each prime at most once in every sum.
You are also allowed to use the number 1 in the sum, but it isn't counted in the answer.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
nobody is confused? :D That's weird
Log in to reply
finally! thanks for the "confused" vote up. For now we have an equal distribution. 24.12.2018 10:57am
How do we know that we cannot do it with 10 primes?
Log in to reply
@Otto Bretscher, thanks for the challenge. Although I proved it some other way, your comment showed an easier way to look at it. I have added a part, as a response to your question. I hope I have not made a mistake. I appreciate if you have a look and give me some feedback. Cheers
Log in to reply
Yes, this is exactly what I had in mind; thank you for the addendum! With the numbers 1 , 2 , 3 you can generate 7 sums (including 0), and with another 8 primes you can generate at most 2 8 = 2 5 6 sums, at most 7 × 2 5 6 = 1 7 9 2 . It's all based on the fact that 3 can be expressed in two ways, 3 = 3 = 1 + 2 .
Beginning at 1 add integers to the set to enable every possible number that is less than or equal to 2018.
The integers 1 and 2 must be in the set as they are the only possible positive integers that can be used in any summation that will equal to 1 or 2. The sum of that very limited subset (1,2) is 3. Using elements from that subset (1,2) 1,2 or 3 can added to any other number to increase the total value by 1 ,2, or 3. The integer 3 would not be required in the full set to arrive at the value 3, but 4 is not a prime number and therefore cannot be included in the full. Set The largest prime number that is less than 4 is 3. 3 must be included in the full set of prime numbers to allow a total of 4 using prime numbers at most once in the sum.
Making successive additions to the full set of integers by including the largest possible qualifying integer (prime numbers only) to the set. Include the largest prime number that is less than or equal to the total sum of the integers in the subset of lesser integers. When the total of all the integers in the set is 2018 or greater that is all that is required. This process increases the range of the set by including the largest prime number that will allow all values to be reached using subsets of the previously include prime numbers combined with the additional larger prime..
determine the largest prime number that is less than or equal to 3 +1 =4
determine the largest prime number that is less than or equal to 6 +1 =7 ...
member | primes | Sum | addition |
count | in set | of set | |
0 | 1 | 1 | |
1 | 2 | 3 | 1+2 |
2 | 3 | 6 | 3+3 |
3 | 7 | 13 | 6+7 |
4 | 13 | 26 | 13+13 |
5 | 23 | 49 | 26+23 |
6 | 47 | 96 | 49+47 |
7 | 97 | 193 | 96+97 |
8 | 193 | 386 | 193+193 |
9 | 383 | 769 | 386+383 |
10 | 769 | 1538 | 769+769 |
11 | 1531 | 3069 | 1538+1531 |
The most time consuming portion of this is finding the largest prime numbers that are smaller than or equal to the total set sums +1.
Problem Loading...
Note Loading...
Set Loading...
Here is an algorithm to generate the minimal set A n that generates positive integers less than or equal to n ∈ N , in a sense asked by the question. From now on, when we say a set A generates n , it means that A generates all integers less than or equal to n .
Also define S ( A ) of a set A to be the sum of all the elements in A .
obviously, A 3 = { 1 , 2 } is the minimal set that generates 3 . Here is a recursive way of defining the minimal sets A t
A t + 1 = A t i f S ( A t ) ≥ t + 1
A t + 1 = A t ∪ { d } , d = m a x { p p r i m e ∣ p ≤ t + 1 } i f S ( A t ) < t + 1
it is not hard to see why the algorithm works (I am too lazy to write)!
But we are not interested in the sets, but their cardinality is of interest. So, we have:
∣ A 3 ∣ = 2
∣ A t + 1 ∣ = ∣ A t ∣ i f S ( A t ) ≥ t + 1
∣ A t + 1 ∣ = ∣ A t ∣ + 1 i f S ( A t ) < t + 1
One can pass the algorithm to computer and realise that 1 1 primes are enough.
Edit: As requested by @Otto Bretscher, I have added a part explaining why 1 0 primes would not be enough.
Assume that there is a set of different primes { p 1 , p 2 , … , p 1 0 } that would generate 2 0 1 8 . We can, algebraically, write the possible numbers, generated by { p 1 , p 2 , … , p 1 0 } , as below
x 0 + x 1 p 1 + ⋯ + x 1 0 p 1 0
where x i ∀ i is either zero or one. There would be a maximum of 2 1 1 = 2 0 4 8 possible numbers, generated by the above expression, when x i ∀ i are changed. of course, some of the combinations amount to the same sum. Also, note that { 2 , 3 } are inevitably in the set that generates 2 0 1 8 , otherwise numbers 2 , 3 cannot be made. Finally pay attention to the two combinations below.
x 0 + x 1 p 1 + ⋯ + x 1 0 p 1 0 = 1 ( 1 ) + 1 ( 2 ) + 0 ( 3 ) + x 3 p 3 + ⋯ + x 1 0 p 1 0 = 3 + x 3 p 3 + ⋯ + x 1 0 p 1 0
x 0 + x 1 p 1 + ⋯ + x 1 0 p 1 0 = 0 ( 1 ) + 0 ( 2 ) + 1 ( 3 ) + x 3 p 3 + ⋯ + x 1 0 p 1 0 = 3 + x 3 p 3 + ⋯ + x 1 0 p 1 0
in the first one, coefficients x 0 , x 1 , x 2 are set to 1 , 1 , 0 and the rest of the coefficients are free to vary. In a similar way, for the second one, coefficients x 0 , x 1 , x 2 are set to 0 , 0 , 1 , while others are free. If we choose the same coefficients for the free variables, in both expressions, they both sum up to the same number. It means that there are at least 2 8 = 2 5 6 (8 for 8 free variables) combinations that give a same sum that already exists. Therefore, there should be less than 2 0 4 8 − 2 5 6 = 1 7 9 2 distinct sum, when { p 1 , p 2 , … , p 1 0 } = ( 2 , 3 , p 3 , … , p 1 0 ) is taken as the generator. But we need it to generate 2 0 1 8 distinct numbers.