login
A345731
Additive bases: a(n) is the least integer such that there is an n-element set of integers between 0 and a(n), the sums of pairs (of distinct elements) of which are distinct.
0
1, 2, 4, 7, 12, 18, 24, 34, 45, 57, 71, 86, 105, 126, 150, 171
OFFSET
2,2
COMMENTS
Such sets are known as weak Sidon sets, weak B_2 sets, or well-spread sequences.
n - 1 <= a(n) <= A003022(n). - Michael S. Branicky, Jun 25 2021
REFERENCES
Alison M. Marr and W. D. Wallis, Magic Graphs, Birkhäuser, 2nd ed., 2013. See Section 2.3.
Xiaodong Xu, Meilian Liang, and Zehui Shao, On weak Sidon sequences, The Journal of Combinatorial Mathematics and Combinatorial Computing (2014), 107--113
LINKS
A. Llado, Largest cliques in connected supermagic graphs, European Journal of Combinatorics 28 (2007), 2240--2247.
EXAMPLE
a(6)=12 because 0-1-2-4-7-12 (0-5-8-10-11-12) resp. 0-1-2-6-9-12 (0-3-6-10-11-12) are shortest weak Sidon sets of size 6.
MATHEMATICA
a[n_Integer?NonNegative] := Module[{k = n - 1}, While[SelectFirst[Subsets[Range[0, k - 1], {n - 1}], Length@Union[Plus @@@ Subsets[#~Join~{k}, {2}]] >= (n*(n - 1))/2 &] === Missing["NotFound"], k++]; k];
Table[a[n], {n, 2, 8}] (* Robert P. P. McKone, Nov 05 2023 *)
PROG
(Python)
from itertools import combinations, count
def a(n):
for k in count(n-1):
for c in combinations(range(k), n-1):
c = c + (k, )
ss = set()
for s in combinations(c, 2):
if sum(s) in ss: break
else: ss.add(sum(s))
if len(ss) == n*(n-1)//2: return k # use (k, c) for sets
print([a(n) for n in range(2, 9)]) # Michael S. Branicky, Jun 25 2021
CROSSREFS
See A003022, A004133, and A004135 for other versions.
Sequence in context: A239955 A346114 A332744 * A084672 A011910 A227590
KEYWORD
nonn,hard,more,nice
AUTHOR
Bernd Mulansky, Jun 25 2021
STATUS
approved