A369149 a(n) is the size of the largest subset of {1,...,n} such that no two elements differ by 4 or 7.
1, 2, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 15, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 32, 32, 33, 33, 34, 34, 34, 35, 35, 35, 36, 37
Offset: 1
Examples
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.
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
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,0,0,1,-1).
Programs
-
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]);
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).
Comments