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 A373046 #50 Oct 01 2024 09:00:49 %S A373046 0,0,0,0,1,4,12,32,79,186,424,944,2065,4456,9512,20128,42287,88310, %T A373046 183492,379624,782497,1607756,3294164,6732992,13732063,27953522, %U A373046 56807184,115269984,233585121,472771152,955843984,1930635712,3896121759,7856343278,15830584396 %N A373046 Number of binary strings of length n that contain the substring 1000. %C A373046 a(n)=2^(n-3)+a(n-1)+a(n-2)+a(n-3)-1 for n>=7. %C A373046 Proof: Copnsider possible endings of the sequence: %C A373046 1. If it ends with 000, then all sequences except 00...0 work, meaning that 2^(n-3)-1 sequences are valid. %C A373046 2. If it ends with 100, then there are a(n-3) valid sequences. %C A373046 3. If it ends with 10, then there are a(n-2) valid sequences. %C A373046 4. If it ends with 1, then there are a(n-1) valid sequences. %C A373046 As these are the only possible endings, the conclusion holds. %C A373046 If we search for a sequence 10...0 (with k zeros), an extended version of the same algorithm gives a(n)=a(n-k)+a(n-k-1)...+a(n-1)+2^(n-k)-1 %H A373046 Paolo Xausa, <a href="/A373046/b373046.txt">Table of n, a(n) for n = 0..1000</a> %H A373046 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (4,-4,0,-1,2). %F A373046 a(n) = 2^(n-3) + a(n-1) + a(n-2) + a(n-3) - 1. %F A373046 a(n) = 3*a(n-1) - a(n-2) - a(n-3) - 2*a(n-4) + 1. %F A373046 G.f.: -x^4/((x-1)*(2*x-1)*(x^3+x^2+x-1)). - _Alois P. Heinz_, Aug 02 2024 %F A373046 2*a(n) = 1+2^(n+1)-A000213(n+3). - _R. J. Mathar_, Aug 28 2024 %e A373046 a(5) = 4: 01000, 11000, 10000, 10001. %t A373046 LinearRecurrence[{4, -4, 0, -1, 2}, {0, 0, 0, 0, 1}, 50] (* _Paolo Xausa_, Oct 01 2024 *) %o A373046 (Python) %o A373046 def aupton(terms): %o A373046 a = [0, 0, 0] %o A373046 for n in range(3, terms): %o A373046 next_term = 2**(n-3) + a[n-1] + a[n-2] + a[n-3] - 1 %o A373046 a.append(next_term) %o A373046 return a[:terms] %o A373046 print(aupton(35)) %Y A373046 Cf. A050232, A232580. %K A373046 nonn,easy %O A373046 0,6 %A A373046 _Deyan Bozhkov_, Aug 02 2024