|
|
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
|
|
|
FORMULA
|
|
|
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
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|