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 A381646 #15 Mar 15 2025 12:31:33 %S A381646 0,0,0,0,6,80,650,4172,23310,119016,571122,2621828,11651222,50536928, %T A381646 215219706,903799548,3754755102,15469272536,63320624642,257886717812, %U A381646 1046169235110,4230947198160,17069749295370,68738191563500,276393979740206 %N A381646 a(n) = 4^n - 2*3^(n-1)*(n+3) + 2^(n-2)*(n^2+3*n+4). %C A381646 a(n) is the number of words of length n defined on 4 letters where two of the letters are used at least twice. %H A381646 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (16,-105,362,-692,696,-288). %F A381646 a(n) = 4^n - 2*3^(n-1)*(n+3) + 2^(n-2)*(n^2+3*n+4). %F A381646 E.g.f. exp(2*x)*(exp(x)-x-1)^2. %F A381646 G.f.: 2*x^4*(3 - 8*x)/((1 - 3*x)^2*(1 - 2*x)^3*(1 - 4*x)). - _Stefano Spezia_, Mar 03 2025 %e A381646 For n=5 the 80 words that use 0 and 1 at least twice are 00111 (10 of this type), 00011 (10 of this type), 00112 (30 of this type), 00113 (30 of this type). %t A381646 LinearRecurrence[{16,-105,362,-692,696,-288},{0,0,0,0,6,80},25] (* _Stefano Spezia_, Mar 03 2025 *) %o A381646 (Python) %o A381646 def A381646(n): return ((1<<n+2)+n*(n+3)+4<<n-3)-(n+3)*3**(n-1)<<1 if n>2 else 0 # _Chai Wah Wu_, Mar 15 2025 %Y A381646 Cf. A112495, A380024, A380249. %K A381646 nonn,easy %O A381646 0,5 %A A381646 _Enrique Navarrete_, Mar 03 2025