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 A209409 #17 May 22 2025 10:21:35 %S A209409 0,0,0,0,0,4,15,37,87,200,448,992,2160,4628,9823,20699,43335,90246, %T A209409 187068,386192,794560,1629944,3334975,6808073,13870191,28207552, %U A209409 57274368,116129280,235165632,475678200,961190943,1940470231,3914210127,7889613022,15891777084 %N A209409 Number of subsets of {1,...,n} containing {a,a+2,a+4} for some a. %C A209409 Also, the number of bitstrings of length n containing 10101,11101,10111 or 11111. %H A209409 G. C. Greubel, <a href="/A209409/b209409.txt">Table of n, a(n) for n = 0..1000</a> %H A209409 <a href="/index/Rec#order_10">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2,2,-4,2,-2,-4,-1,1,2). %F A209409 A(n) = 2^n - A209410(n) %F A209409 a(n) = 2^n - t[floor(n/2)+2]*t[floor((n+1)/2)+2] where t(n) is the n-th tribonacci number. %F A209409 a(n) = 3*a(n-1) - 2*a(n-2) + 2*a(n-3) - 4*a(n-4) + 2*a(n-5) - 2*a(n-6) - 4*a(n-7) - a(n-8) + a(n-9) + 2*a(n-10). %F A209409 G.f.: x^5*(4 + 3*x - 2*x^3 - x^4)/((1 - 2*x) (1 - x - x^2 - x^3) (1 + x^2 + x^4 - x^6)). %e A209409 For n=5, subsets containing {a,a+2,a+4} occur only when a=1. There are 2^2 subsets including {1,3,5}, thus a(5) = 4. %t A209409 LinearRecurrence[{3, -2, 2, -4, 2, -2, -4, -1, 1, 2}, {0, 0, 0, 0, 0, 4, 15, 37, 87, 200}, 40] %o A209409 (Python) %o A209409 #Returns the actual list of valid subsets %o A209409 def containscode(n,bitstring=(1,0,1,0,1)): %o A209409 patterns=list() %o A209409 for start in range (1,n-len(bitstring)+2): %o A209409 s=set() %o A209409 for i in range(len(bitstring)): %o A209409 if bitstring[i]: %o A209409 s.add(start+i) %o A209409 patterns.append(s) %o A209409 s=list() %o A209409 for i in range(sum(bitstring),n+1): %o A209409 for temptuple in comb(range(1,n+1),i): %o A209409 tempset=set(temptuple) %o A209409 for sub in patterns: %o A209409 if sub <= tempset: %o A209409 s.append(tempset) %o A209409 break %o A209409 return s %o A209409 #Counts all such sets %o A209409 def countcontainscode(n,bitstring=(1,0,1,0,1)): %o A209409 return len(containscode(n)) %o A209409 (Python) %o A209409 #From recurrence %o A209409 def a(n, adict={0:0, 1:0, 2:0, 3:0, 4:0, 5:4, 6:15, 7:37, 8:87, 9:200}): %o A209409 if n in adict: %o A209409 return adict[n] %o A209409 adict[n]=3*a(n-1) - 2*a(n-2) + 2*a(n-3) - 4*a(n-4) + 2*a(n-5) - 2*a(n-6) - 4*a(n-7) - a(n-8) + a(n-9) + 2*a(n-10) %o A209409 return adict[n] %o A209409 (PARI) x='x+O('x^30); concat([0,0,0,0,0], Vec(x^5*(4+3*x-2*x^3-x^4)/((1- 2*x)*(1-x-x^2-x^3)*(1+x^2+x^4-x^6)))) \\ _G. C. Greubel_, Jan 03 2018 %Y A209409 Cf. A209408, A209410. %K A209409 nonn,easy %O A209409 0,6 %A A209409 _David Nacin_, Mar 08 2012