A351124 a(n) is the least k > 0 such that the set { prime(n), ..., prime(n+k-1) } can be partitioned into two disjoint sets with equal sum, or -1 if no such k exists (prime(n) denotes the n-th prime number).
3, 6, 4, 4, 4, 4, 8, 10, 4, 8, 8, 4, 10, 14, 6, 4, 6, 6, 8, 8, 4, 8, 12, 10, 4, 4, 4, 8, 4, 8, 6, 10, 4, 6, 8, 18, 4, 6, 8, 6, 4, 12, 4, 8, 10, 6, 10, 4, 8, 6, 8, 12, 10, 4, 6, 4, 8, 8, 10, 8, 12, 8, 4, 12, 6, 6, 8, 8, 14, 8, 4, 8, 10, 4, 10, 6, 4, 10, 8, 4, 4
Offset: 1
Keywords
Examples
The first terms, alongside an appropriate partition {P, Q}, are: n a(n) P Q -- ---- -------------------- -------------------- 1 3 {2, 3} {5} 2 6 {3, 5, 7, 13} {11, 17} 3 4 {5, 13} {7, 11} 4 4 {7, 17} {11, 13} 5 4 {11, 19} {13, 17} 6 4 {13, 23} {17, 19} 7 8 {17, 29, 31, 43} {19, 23, 37, 41} 8 10 {19, 31, 41, 47, 53} {23, 29, 37, 43, 59} 9 4 {23, 37} {29, 31} 10 8 {29, 41, 47, 53} {31, 37, 43, 59}
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..20000
Crossrefs
Cf. A022884.
Programs
-
PARI
a(n) = { my (s=[0], k=0); forprime (p=prime(n), oo, s=setunion(apply (v -> v-p, s), apply (v -> v+p, s)); k++; if (setsearch(s, 0), return (k))) }
Formula
a(n) = 4 iff n belongs to A022884.
Comments