This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A209400 #24 May 23 2025 14:27:46 %S A209400 0,0,0,0,2,7,19,46,107,242,535,1162,2490,5281,11108,23206,48206,99663, %T A209400 205218,421115,861585,1758249,3580075,7275377,14759592,29897683, %U A209400 60481359,122206014,246665382,497414751,1002231335,2017877779,4060069150,8164204342 %N A209400 Number of subsets of {1,...,n} containing a subset of the form {k,k+1,k+3} for some k. %C A209400 Also, number of subsets of {1,...,n} containing {a,a+2,a+3} for some a. %C A209400 Also, number of bitstrings of length n containing 1101 or 1111. %H A209400 David Nacin, <a href="/A209400/b209400.txt">Table of n, a(n) for n = 0..500</a> %H A209400 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (3,-1,-2,1,-1,-2). %F A209400 a(n) = 3*a(n-1) - a(n-2) - 2*a(n-3) + a(n-4) - a(n-5) - 2*a(n-6), a(4)=2, a(5)=7, a(i)=0 for i<4. %F A209400 G.f.: x^4*(2 + x)/(1 - 3*x + x^2 + 2*x^3 - x^4 + x^5 + 2*x^6) = x^4*(2 + x)/((1 - 2*x)*(1 - x - x^2 - x^4 - x^5)). %F A209400 a(n) = 2^n - A164387(n). %e A209400 When n=4 the only subsets containing an {a,a+1,a+3} happen when a=1 with the two subsets {1,2,3,4} and {1,2,4}. Thus a(4)=2. %t A209400 LinearRecurrence[{3, -1, -2, 1, -1, -2}, {0, 0, 0, 0, 2, 7}, 40] %t A209400 CoefficientList[Series[x^4*(2+x)/(1-3*x+x^2+2*x^3-x^4+x^5+2*x^6), {x,0, 50}], x] (* _G. C. Greubel_, Jan 03 2018 *) %o A209400 (Python) %o A209400 #From recurrence %o A209400 def a(n, adict={0:0, 1:0, 2:0, 3:0, 4:2, 5:7}): %o A209400 if n in adict: %o A209400 return adict[n] %o A209400 adict[n]=3*a(n-1)-a(n-2)-2*a(n-3)+a(n-4)-a(n-5)-2*a(n-6) %o A209400 return adict[n] %o A209400 (Python) %o A209400 #Returns the actual list of valid subsets %o A209400 def contains1101(n): %o A209400 patterns=list() %o A209400 for start in range (1,n-2): %o A209400 s=set() %o A209400 for i in range(4): %o A209400 if (1,1,0,1)[i]: %o A209400 s.add(start+i) %o A209400 patterns.append(s) %o A209400 s=list() %o A209400 for i in range(2,n+1): %o A209400 for temptuple in comb(range(1,n+1),i): %o A209400 tempset=set(temptuple) %o A209400 for sub in patterns: %o A209400 if sub <= tempset: %o A209400 s.append(tempset) %o A209400 break %o A209400 return s %o A209400 #Counts all such sets %o A209400 def countcontains1101(n): %o A209400 return len(contains1101(n)) %o A209400 (PARI) x='x+O('x^30); concat([0,0,0,0], Vec(x^4*(2+x)/(1-3*x+x^2+2*x^3-x^4+x^5+2*x^6))) \\ _G. C. Greubel_, Jan 03 2018 %o A209400 (Magma) I:=[0, 0, 0, 0, 2, 7]; [n le 6 select I[n] else 3*Self(n-1) - Self(n-2)-2*Self(n-3)+Self(n-4)-Self(n-5)-2*Self(n-6): n in [0..30]]; // _G. C. Greubel_, Jan 03 2018 %Y A209400 Cf. A209398, A209399, A164387. %K A209400 nonn,easy %O A209400 0,5 %A A209400 _David Nacin_, Mar 07 2012