OFFSET
1,2
COMMENTS
a(n) is the independence number of the graph with vertices 1,...,n and edges joining vertices that differ by 4 or 7.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Mathematics StackExchange, Biggest subset of 1,2,...,1000 such that difference between any pair of elements =/= 4, 7
FORMULA
a(n+11) = a(n) + 5 for n > 5.
G.f.: (x + x^2 + x^3 + x^4 + x^9 - x^14 + x^17)/(1 - x - x^11 + x^12).
EXAMPLE
a(10) = 5 because {1, 2, 4, 7, 10} is a 5-element subset of {1,...,10} which has no two elements differing by 4 or 7, and there is no larger subset that works.
MAPLE
f:= proc(n) local L, i;
L:= convert(n, base, 11);
[0, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5][L[1]+1] + add(5*L[i]*11^(i-2), i=2..nops(L))
end proc:
f(3):= 3: f(4):= 4: f(5):= 4:
map(f, [$1..100]);
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Jan 14 2024
STATUS
approved