Given a finite set $S$ of positive integers, and a positive integer $n$, let $F(n,S)$ be the largest possible cardinality of a subset of {$1,2,\dots,n$} no two of whose elements differ by a number in $S$.
E.g., if $S=${$2,3$} and $n=10$, we have $F(n,S)=4$ corresponding for instance to the set {$1,2,6,7$}.
What is known about the computational complexity of $F$?
A purely greedy approach doesn't work. E.g., if $S=${$3,5$} and $n=20$, a greedy approach gives the set {$1,2,3,9,10,11,17,18,19$} which has smaller cardinality than {$1,3,5,7,9,11,13,15,17,19$}.
Dynamic programming works, but takes computational resources that are exponential in max($S$). Can one do better?
I don't like the name of this question; if anyone can think of a better way to describe the problem, please feel free to revise it.