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 A383343 #15 May 01 2025 18:15:24 %S A383343 0,0,1,8,42,172,611,2004,6292,19304,58533,176464,530558,1593204, %T A383343 4781575,14347196,43044648,129137680,387417545,1162258008,3486780370, %U A383343 10460348540,31381054251,94143172708,282429529532,847288601592,2541865819501,7625597475104,22876792443942,68630377352644,205891132081103 %N A383343 a(n) = 3^n - 3*binomial(n,3) - 3*binomial(n,2) - 2*n - 1. %C A383343 a(n) is the number of ternary strings of length n that contain at least two 1s or at least three 2s (or both). %H A383343 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (7,-18,22,-13,3). %F A383343 a(n) = 7*a(n-1) - 18*a(n-2) + 22*a(n-3) - 13*a(n-4) + 3*a(n-5), n>4. %F A383343 From _Stefano Spezia_, Apr 24 2025: (Start) %F A383343 G.f.: x^2*(1 + x + 4*x^2)/((1 - x)^4*(1 - 3*x)). %F A383343 E.g.f.: exp(3*x) - exp(x)*(2 + 4*x + 3*x^2 + x^3)/2. (End) %F A383343 a(n) = 3^n - A127873(n-1). %e A383343 a(3) = 8 since the strings are 110 (3 of this type), 112 (3 of this type), 111, and 222. %t A383343 a[n_] := 3^n - 3*Binomial[n, 3] - 3*Binomial[n, 2] - 2*n - 1; Array[a, 31, 0] (* _Amiram Eldar_, Apr 24 2025 *) %Y A383343 Cf. A127873. %K A383343 nonn,easy %O A383343 0,4 %A A383343 _Enrique Navarrete_, Apr 23 2025