关于用前n个素数构造所有连续子段和唯一序列的可行性问询
Suppose we have a sequence where every possible consecutive subsegment has a unique sum. For example, take the sequence 2,7,3,5—all its subsegment sums are distinct:
$$2, 2+7, 2+7+3, 2+7+3+5, 7, 7+3, 7+3+5, 3, 3+5, 5$$
The core question here is: can we generate such a sequence using the first $n$ prime numbers for any given $n$?
My Approach & Observations
I started by exploring simpler cases first, using natural numbers instead of primes. It turns out that for $n \geq 4$, we can't construct such a sequence with the first $n$ natural numbers. Here's why: the total number of subsegments is $\frac{n(n+1)}{2}$, which exactly equals the sum of the first $n$ natural numbers. That means we need subsegment sums ranging from 1 up to that total. But to get sums like $\frac{n(n+1)}{2}-1$ and $\frac{n(n+1)}{2}-2$, we'd have to place 1 and 2 at the ends of the sequence. Then, the neighbor of 1 has to be $n$ (since any other number plus 1 would overlap with an existing single-element sum), and the neighbor of 2 has to be $n-1$. But $2+(n-1) = n+1$, which is the same as $1+n$—so we get a duplicate sum right there, breaking the uniqueness condition.
Next, I ran computer searches for sequences using odd numbers. I found that we can build valid sequences for odd numbers up to 29, but not for the full set of odds from 1 to 31.
For primes specifically, my computer search showed we can construct valid sequences for $n \leq 40$. Below are the lexicographically smallest sequences I found for each $n$:
2 2 3 2 5 3 2 7 3 5 2 7 3 5 11 2 7 3 5 11 13 2 7 3 11 5 13 17 2 7 3 11 17 5 13 19 2 7 3 17 5 13 23 19 11 2 7 3 23 5 17 19 11 13 29 2 7 3 23 11 13 19 29 31 5 17 2 7 3 23 13 5 29 11 17 37 31 19 2 7 3 23 13 11 19 37 31 29 5 17 41 2 7 3 23 13 11 31 41 29 5 17 43 19 37 2 7 3 23 13 17 37 5 19 47 11 41 29 31 43 2 7 3 23 13 19 31 11 41 53 29 43 47 37 17 5 2 7 3 23 13 19 31 11 29 53 17 5 59 47 41 43 37 2 7 3 23 13 19 31 29 11 5 61 53 59 41 47 17 37 43 2 7 3 23 13 29 31 19 5 47 41 53 61 43 67 11 59 17 37 2 7 3 23 13 29 31 19 5 59 41 61 17 53 37 43 67 71 11 47 2 7 3 23 13 29 37 17 41 43 31 61 67 19 71 59 47 73 5 11 53 2 7 3 23 13 29 41 11 5 53 31 19 73 67 79 47 43 61 17 37 59 71 2 7 3 23 13 29 43 17 37 41 83 67 79 31 19 71 61 73 11 59 47 53 5 2 7 3 23 13 29 43 19 31 47 17 59 89 83 67 71 53 5 61 37 73 79 11 41 2 7 3 23 13 29 43 19 31 53 11 79 73 67 89 71 41 61 5 83 59 47 97 37 17 2 7 3 23 13 29 43 19 31 53 11 5 97 83 73 101 71 41 47 89 59 67 61 37 17 79 2 7 3 23 13 29 43 19 31 59 5 53 97 103 101 73 89 17 83 71 11 41 61 67 79 47 37 2 7 3 23 13 29 43 19 31 59 5 53 47 79 97 83 71 107 101 89 17 37 61 67 73 11 41 103 2 7 3 23 13 29 43 19 31 67 17 11 41 107 101 97 83 89 103 59 37 109 5 73 79 61 71 53 47 2 7 3 23 13 29 43 19 31 67 17 11 59 89 107 73 71 53 47 109 37 113 79 103 97 41 101 61 5 83 2 7 3 23 13 29 43 47 5 11 53 17 59 67 97 103 113 109 73 83 101 79 89 61 41 37 107 71 127 19 31 2 7 3 23 13 29 43 47 5 11 53 17 59 71 109 103 19 31 67 97 131 127 79 83 113 41 101 107 37 89 61 73 2 7 3 23 13 29 43 47 31 61 37 17 79 73 97 5 71 83 131 109 113 67 89 59 103 19 107 127 101 137 53 41 11 2 7 3 23 13 29 43 47 31 67 17 11 53 5 137 71 101 79 103 19 127 109 139 83 107 37 59 97 131 89 113 41 61 73 2 7 3 23 13 29 43 47 31 67 17 11 53 5 137 113 107 97 71 89 101 109 131 83 73 103 37 19 127 149 59 41 61 139 79 2 7 3 23 13 29 43 47 31 67 17 11 53 61 79 73 137 113 71 59 109 103 139 151 101 127 149 89 131 5 83 107 37 97 19 41 2 7 3 23 13 29 43 47 31 67 17 11 53 5 83 137 149 89 71 59 131 97 107 73 61 79 139 109 113 101 151 103 157 37 127 19 41 2 7 3 23 13 29 43 47 53 5 11 71 41 61 113 17 89 73 139 157 163 107 59 83 109 37 101 137 31 149 97 103 151 19 67 131 127 79 2 7 3 23 13 29 43 53 37 79 5 11 47 41 89 137 101 139 167 83 113 31 163 71 151 107 109 97 127 73 157 61 131 59 17 149 103 67 19 2 7 3 23 13 29 43 61 19 37 59 47 41 11 131 73 97 89 107 101 31 137 167 139 163 109 149 173 151 127 79 103 157 17 67 113 53 83 71 5
Looking at these results, I noticed that as $n$ increases, the lexicographically smallest sequence tends to include larger primes earlier on. This trend makes me suspect that there might be some threshold $n$ beyond which it's impossible to construct such a sequence using the first $n$ primes—though we haven't hit that point yet for $n \leq 40$.
备注:内容来源于stack exchange,提问作者dodicta




