The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A051013 Number of nonaveraging subsets on {1,2,...,n}. 7
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
Fausto A. C. Cariboni, Table of n, a(n) for n = 0..80
Eric Weisstein's World of Mathematics, Nonaveraging Sequence
FORMULA
a(n) = 2^n - A018788(n). - David Nacin, Mar 03 2012
EXAMPLE
The only subset of s = {1,2,3} that contains a 3-term arithmetic progression is s itself, so a(3) = 7.
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 *)
PROG
(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
CROSSREFS
Cf. A018788.
Row sums of A334187.
First differences give A334893.
Sequence in context: A001036 A054150 A130709 * A128609 A335471 A168043
KEYWORD
nonn
AUTHOR
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
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 15 08:34 EDT 2024. Contains 372538 sequences. (Running on oeis4.)