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 A380024 #28 Mar 03 2025 16:28:48 %S A380024 0,1,6,28,121,511,2152,9094,38563,163729,694282,2934592,12348541, %T A380024 51697075,215291356,891989002,3677964295,15099277669,61745907934, %U A380024 251632677604,1022414950465,4143511249831,16755357788176,67628131638478,272531374722091 %N A380024 a(n) = 4^n - 3^n - binomial(n,2)*3^(n-2). %C A380024 a(n) is the number of words of length n defined on 4 letters where one of the letters is used at least once but not twice. %H A380024 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (13,-63,135,-108). %F A380024 E.g.f.: exp(3*x)*(exp(x)-(x^2)/2-1). %F A380024 G.f.: x*(1 - 7*x + 13*x^2)/((1 - 3*x)^3*(1 - 4*x)). - _Stefano Spezia_, Mar 03 2025 %e A380024 For n=2, the 6 words on {0, 1, 2, 3} that use 0 at least once but not twice are 10, 01, 20, 02, 30, 03. %t A380024 Array[4^#-3^#-Binomial[#,2]*3^(#-2)&,25,0] (* or *) LinearRecurrence[{13,-63,135,-108},{0,1,6,28},25] (* _James C. McMahon_, Feb 14 2025 *) %o A380024 (Python) %o A380024 def A380024(n): return (1<<(n<<1))-((n*(n-1)>>1)+9)*3**(n-2) if n>1 else n # _Chai Wah Wu_, Feb 14 2025 %Y A380024 Cf. A005061, A086443, A380651. %K A380024 nonn,easy %O A380024 0,3 %A A380024 _Enrique Navarrete_, Feb 05 2025