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 A177261 #21 May 14 2024 16:20:24 %S A177261 1,0,0,1,7,35,218,1574,12883,117956,1195590,13295211,160974037, %T A177261 2108348871,29704448652,447997026724,7201873573981,122939256681704, %U A177261 2221004487898100,42336428273893565,849195448479132811,17879882855311478795,394291291121879453430 %N A177261 Number of derangements of {1,2,...,n} having no adjacent 2-cycles and no adjacent 3-cycles (an adjacent q-cycle is a cycle of the form (i,i+1,i+2,...,i+q-1)). %H A177261 G. C. Greubel, <a href="/A177261/b177261.txt">Table of n, a(n) for n = 0..445</a> %H A177261 R. A. Brualdi and E. Deutsch, <a href="http://arxiv.org/abs/1005.0781">Adjacent q-cycles in permutations</a>, arXiv:1005.0781v1. %F A177261 a(n) = Sum_{s=0..n} Sum_{t=0..floor((n-j)/2)} Sum_{u=0..floor((n-j-2*t)/3)} (-1)^(s+t+u)*(n-t-2*u)!/(s!*t!*u!). %F A177261 a(n) ~ exp(-1) * n!. - _Vaclav Kotesovec_, Dec 10 2021 %F A177261 G.f.: Sum_{k>=0} k! * x^k * ( (1-x)/(1-x^4) )^(k+1). - _Seiichi Manyama_, Feb 20 2024 %e A177261 a(5)=35 because among the 44 (= A000166(5)) derangements of {1,2,3,4,5} only (12)(345), (12)(354), (145)(23), (154)(23), (125)(34), (152)(34), (123)(45), (132)(45) , and (15)(234) have adjacent 2-cycles or adjacent 3-cycles (or both). %p A177261 a := proc (n) local ct, t, s, u: ct := 0: for s from 0 to n do for t from 0 to n do for u from 0 to n do if s+2*t+3*u <= n then ct := ct+(-1)^(s+t+u)*factorial(n-t-2*u)/(factorial(s)*factorial(t)*factorial(u)) else end if end do end do end do: ct end proc; seq(a(n), n = 0 .. 22); %t A177261 a[n_] := Sum[If[s + 2*t + 3*u <= n, (-1)^(s + t + u)*(n - t - 2 u)!/(s! t! u!), 0], {s, 0, n}, {t, 0, n}, {u, 0, n}]; %t A177261 Table[a[n], {n, 0, 22}] (* _Jean-François Alcover_, Dec 04 2017 *) %t A177261 With[{m=40}, CoefficientList[Series[Sum[k!*(x*(1-x)/(1-x^4))^(k+1)/x,{k,0,m+2}], {x,0,m}], x]] (* _G. C. Greubel_, May 13 2024 *) %o A177261 (Magma) %o A177261 m:=30; %o A177261 R<x>:=PowerSeriesRing(Integers(), m); %o A177261 Coefficients(R!( (&+[Factorial(k)*(x*(1-x)/(1-x^4))^(k+1)/x: k in [0..m+2]]) )); // _G. C. Greubel_, May 13 2024 %o A177261 (SageMath) %o A177261 m=30 %o A177261 def A177261_list(prec): %o A177261 P.<x> = PowerSeriesRing(ZZ, prec) %o A177261 return P( sum(factorial(k)*(x*(1-x)/(1-x^4))^(k+1)/x for k in range(m+3)) ).list() %o A177261 A177261_list(m) # _G. C. Greubel_, May 13 2024 %Y A177261 Cf. A000166, A177258, A177259, A177260. %K A177261 nonn %O A177261 0,5 %A A177261 _Emeric Deutsch_, May 08 2010