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}.

Original entry on oeis.org

1, 2, 4, 7, 13, 23, 40, 65, 106, 169, 278, 443, 705, 1117, 1760, 2692, 4151, 6314, 9526, 14127, 20944, 30848, 45589, 66495, 96847, 140840, 204380, 293822, 425859, 613446, 880288, 1258349, 1794256, 2545965, 3623774, 5123746, 7207773, 10159163, 14273328, 19925242, 27893419
Offset: 0

Views

Author

Keywords

Examples

			The only subset of s = {1,2,3} that contains a 3-term arithmetic progression is s itself, so a(3) = 7.
		

Crossrefs

Cf. A018788.
Row sums of A334187.
First differences give A334893.

Programs

  • Mathematica
    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 *)
  • Python
    # Prints out all such sets
    def nonaveragingsets(n):
        avoid=list()
        for skip in range(1,(n+1)//2):
            for start in range (1,n+1-2*skip):
                avoid.append(set({start,start+skip,start+2*skip}))
        s=list()
        for i in range(3):
            for smallset in comb(range(1,n+1),i):
                s.append(smallset)
        for i in range(3,n+1):
            for temptuple in comb(range(1,n+1),i):
                tempset=set(temptuple)
                status=True
                for avoidset in avoid:
                    if avoidset <= tempset:
                        status=False
                        break
                if status:
                    s.append(tempset)
        return s
    # Counts all such sets
    def a(n):
        return len(nonaveragingsets(n)) # David Nacin, Mar 03 2012

Formula

a(n) = 2^n - A018788(n). - David Nacin, Mar 03 2012

Extensions

More terms from John W. Layman, Nov 27 2001
a(29)-a(37) from Donovan Johnson, Aug 15 2010
a(38)-a(40) from Alois P. Heinz, Oct 27 2011