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 A140526 #12 Oct 13 2017 17:30:10 %S A140526 1,4,29,230,2033,19744,209581,2418226,30173825,405194012,5830108061, %T A140526 89520810334,1461569944369,25288635875320,462312939395693, %U A140526 8905623605897834,180313351427440001,3828575562533760436 %N A140526 Number of derangements of n elements with one pair repeated exactly once (e.g., "ABABCDEF"). %H A140526 Hugo M. Spinelli, <a href="http://phpfi.com/328543">Program code related to this sequence</a> %F A140526 a(n) = ( (n^4 - 10*n^3 + 37*n^2 - 56*n + 25) * A000166(n-4) + (-1)^n * (-n^3 + 8*n^2 - 22*n + 19) ) / 4. - _Max Alekseyev_, Sep 22 2009 %e A140526 a(4)=1 because "aabb" has only one derangement: "bbaa"; %e A140526 a(5)=4 because "aabbc" has four derangements: "bbaca", "bbcaa", "bcaab" and "cbaab". %t A140526 A000166[n_] := Floor[n!/E + 1/2]; a[4] = 1; a[n_] := ((n^4 - 10*n^3 + 37*n^2 - 56*n + 25)*A000166[n-4] + (-1)^n*(-n^3 + 8*n^2 - 22*n + 19))/4; Table[ a[n], {n, 4, 21}] (* _Jean-François Alcover_, Jan 30 2012, after _Max Alekseyev_ *) %Y A140526 Cf. A105927 for derangements with an element repeated exactly once and no other repetition (e.g., "AABCDEF"); A105928 for derangements with an element appearing three times and no other repetition (e.g., "AAABCDEF"). %K A140526 nonn,nice %O A140526 4,2 %A A140526 Hugo M. Spinelli (woodcroft(AT)poli.ufrj.br), Jul 02 2008, Jul 25 2008 %E A140526 Extended by _Max Alekseyev_, Sep 22 2009