OFFSET
0,6
LINKS
Sean A. Irvine, Table of n, a(n) for n = 0..39
FORMULA
a(n) = 2^n - A066369(n).
EXAMPLE
In {1,2,3,4,5} the only length 4 progressions possible are 1,2,3,4 and 2,3,4,5. There are three sets containing one or more of these: {1,2,3,4},{2,3,4,5}, and {1,2,3,4,5}. Thus a(5) = 3. - David Nacin, Mar 05 2012
PROG
(Python)
from itertools import combinations
# Prints out all such sets
def containsap4(n):
ap4list = list()
for skip in range(1, (n + 2) // 3):
for start in range(1, n + 1 - 3 * skip):
ap4list.append(
set({start, start + skip, start + 2 * skip, start + 3 * skip})
)
s = list()
for i in range(4, n + 1):
for temptuple in combinations(range(1, n + 1), i):
tempset = set(temptuple)
for sub in ap4list:
if sub <= tempset:
s.append(tempset)
break
return s
# Counts all such sets
def a(n):
return len(containsap4(n)) # David Nacin, Mar 05 2012
for n in range(20):
print(a(n), end=", ")
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved