cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A305503 Largest cardinality of subsets A of {0,1,...,n-1} with |A + A| > |A - A|.

This page as a plain text file.
%I A305503 #32 Jun 01 2020 20:48:33
%S A305503 0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,10,11,12,13,14,15,16,17,18,19,20,21,
%T A305503 22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40
%N A305503 Largest cardinality of subsets A of {0,1,...,n-1} with |A + A| > |A - A|.
%C A305503 All the possible 'A's are explicitly generated and sorted according to their cardinality.
%H A305503 P. V. Hegarty, <a href="https://www.impan.pl/shop/en/publication/transaction/download/product/83466">Some explicit constructions of sets with more sums than differences</a>, Acta Arith., 130 (2007), 61-77.
%H A305503 Greg Martin and Kevin O'Bryant, <a href="http://arxiv.org/abs/math/0608131">Many sets have more sums than differences</a>, arXiv:math/0608131 [math.NT], 2006-2007.
%F A305503 a(n) = n - 7 (conjectured) for all n > 15.
%F A305503 Conjectures from _Colin Barker_, Jun 01 2020: (Start)
%F A305503 G.f.: x^14*(9 - 9*x + x^2) / (1 - x)^2.
%F A305503 a(n) = 2*a(n-1) - a(n-2) for n>17.
%F A305503 (End)
%e A305503 For n = 15, the subsets A of {0,1,...,n-1} with |A + A| > |A - A| are (0, 2, 3, 4, 7, 11, 12, 14); (0, 2, 3, 7, 10, 11, 12, 14); (0, 1, 2, 4, 5, 9, 12, 13, 14) and (0, 1, 2, 5, 9, 10, 12, 13, 14). So, the largest cardinality is 9.
%o A305503 (Python)
%o A305503 import numpy as np
%o A305503 import itertools
%o A305503 def findsubsets(S, m):
%o A305503     return itertools.combinations(S, m)
%o A305503 def mstd(a):
%o A305503     a1 = set()
%o A305503     a2 = set()
%o A305503     for i in a:
%o A305503         for j in a:
%o A305503             a1.add(i + j)
%o A305503             a2.add(i - j)
%o A305503     return len(a1) > len(a2)
%o A305503 def a(n):
%o A305503     ans = 0
%o A305503     Nn = list(range(n))
%o A305503     for k in range(1, n):
%o A305503         if any(mstd(i) for i in findsubsets(Nn, k)):
%o A305503             ans = k
%o A305503     return ans
%Y A305503 Cf. A118544, A222807, A222808, A291514.
%K A305503 more,hard,nonn
%O A305503 1,15
%A A305503 _Tanuj Mathur_, Jun 03 2018