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.

A051013 Number of nonaveraging subsets on {1,2,...,n}.

This page as a plain text file.
%I A051013 #45 Feb 16 2025 08:32:41
%S A051013 1,2,4,7,13,23,40,65,106,169,278,443,705,1117,1760,2692,4151,6314,
%T A051013 9526,14127,20944,30848,45589,66495,96847,140840,204380,293822,425859,
%U A051013 613446,880288,1258349,1794256,2545965,3623774,5123746,7207773,10159163,14273328,19925242,27893419
%N A051013 Number of nonaveraging subsets on {1,2,...,n}.
%H A051013 Fausto A. C. Cariboni, <a href="/A051013/b051013.txt">Table of n, a(n) for n = 0..80</a>
%H A051013 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/NonaveragingSequence.html">Nonaveraging Sequence</a>
%H A051013 Wikipedia, <a href="https://en.wikipedia.org/wiki/Salem-Spencer_set">Salem-Spencer set</a>
%H A051013 <a href="/index/No#non_averaging">Index entries related to non-averaging sequences</a>
%F A051013 a(n) = 2^n - A018788(n). - _David Nacin_, Mar 03 2012
%e A051013 The only subset of s = {1,2,3} that contains a 3-term arithmetic progression is s itself, so a(3) = 7.
%t A051013 a[n_] := a[n] = 2^n - Count[Subsets[Range[n], {3, n}], {___, a_, ___, b_, ___, c_, ___} /; b-a == c-b]; Table[Print[n, " ", a[n]]; a[n], {n, 0, 32}] (* _Jean-François Alcover_, May 30 2019 *)
%o A051013 (Python)
%o A051013 # Prints out all such sets
%o A051013 def nonaveragingsets(n):
%o A051013     avoid=list()
%o A051013     for skip in range(1,(n+1)//2):
%o A051013         for start in range (1,n+1-2*skip):
%o A051013             avoid.append(set({start,start+skip,start+2*skip}))
%o A051013     s=list()
%o A051013     for i in range(3):
%o A051013         for smallset in comb(range(1,n+1),i):
%o A051013             s.append(smallset)
%o A051013     for i in range(3,n+1):
%o A051013         for temptuple in comb(range(1,n+1),i):
%o A051013             tempset=set(temptuple)
%o A051013             status=True
%o A051013             for avoidset in avoid:
%o A051013                 if avoidset <= tempset:
%o A051013                     status=False
%o A051013                     break
%o A051013             if status:
%o A051013                 s.append(tempset)
%o A051013     return s
%o A051013 # Counts all such sets
%o A051013 def a(n):
%o A051013     return len(nonaveragingsets(n)) # _David Nacin_, Mar 03 2012
%Y A051013 Cf. A018788.
%Y A051013 Row sums of A334187.
%Y A051013 First differences give A334893.
%K A051013 nonn
%O A051013 0,2
%A A051013 _Eric W. Weisstein_
%E A051013 More terms from _John W. Layman_, Nov 27 2001
%E A051013 a(29)-a(37) from _Donovan Johnson_, Aug 15 2010
%E A051013 a(38)-a(40) from _Alois P. Heinz_, Oct 27 2011