login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A018788 Number of subsets of { 1, ..., n } containing an A.P. of length 3. 1
0, 0, 0, 1, 3, 9, 24, 63, 150, 343, 746, 1605, 3391, 7075, 14624, 30076, 61385, 124758, 252618, 510161, 1027632, 2066304, 4148715, 8322113, 16680369, 33413592, 66904484, 133923906, 268009597, 536257466, 1072861536, 2146225299, 4293173040 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,5

LINKS

Table of n, a(n) for n=0..32.

FORMULA

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

EXAMPLE

For n=4 the only subsets containing an A.P. of length 3 are {1,2,3},{2,3,4} and {1,2,3,4}.  This a(4) = 3. - David Nacin, Mar 03 2012

PROG

(Python)

#Prints out all such sets

def containsap3(n):

.ap3list=list()

.for skip in range(1, (n+1)//2):

..for start in range (1, n+1-2*skip):

...ap3list.append(set({start, start+skip, start+2*skip}))

.s=list()

.for i in range(3, n+1):

..for temptuple in comb(range(1, n+1), i):

...tempset=set(temptuple)

...for sub in ap3list:

....if sub <= tempset:

.....s.append(tempset)

.....break

.return s #

#Counts all such sets

def a(n):

.return len(containsap3(n)) # - David Nacin, Mar 03 2012

CROSSREFS

Cf. A051013

Sequence in context: A079282 A117585 A006684 * A098690 A090400 A123888

Adjacent sequences:  A018785 A018786 A018787 * A018789 A018790 A018791

KEYWORD

nonn

AUTHOR

David W. Wilson

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified May 23 22:33 EDT 2013. Contains 225613 sequences.