A152086
a(n) = Sum_{k=1..n-1} k*A110971(n,k).
Original entry on oeis.org
1, 3, 8, 21, 52, 126, 296, 685, 1556, 3498, 7768, 17122, 37416, 81308, 175568, 377469, 807604, 1721970, 3657464, 7746838, 16357496, 34459428, 72407728, 151851986, 317777032, 663908196, 1384524656, 2883208740, 5994736336, 12448784824, 25816193952, 53479331357, 110652549620
Offset: 2
-
A110971[n_] := (n+1)*2^(n-2) - If[OddQ[n], (n-1/2)*Binomial[n-1, (n-1)/2], 2*(n-1)*Binomial[n-2, (n-2)/2]];
Array[A110971, 50, 2] (* Paolo Xausa, Oct 13 2024 *)
-
from math import comb
def A152086(n): return ((n+1<>1)>>1 if n&1 else (n-1)*comb(n-2,n-2>>1)<<1)) # Chai Wah Wu, Oct 28 2024
A102699
Number of strings of length n, using as symbols numbers from the set {1, 2, ..., n}, in which consecutive symbols differ by exactly 1.
Original entry on oeis.org
1, 1, 2, 6, 16, 42, 104, 252, 592, 1370, 3112, 6996, 15536, 34244, 74832, 162616, 351136, 754938, 1615208, 3443940, 7314928, 15493676, 32714992, 68918856, 144815456, 303703972, 635554064, 1327816392, 2769049312, 5766417480, 11989472672, 24897569648
Offset: 0
Don Rogers (donrogers42(AT)aol.com), Feb 07 2005
For example, a(4)=16: the 16 strings are 1212, 1232, 1234, 2121, 2123, 2321, 2323, 2343, 3212, 3232, 3234, 3432, 3434, 4321, 4323, 4343.
G.f. = x + 2*x^2 + 6*x^3 + 16*x^4 + 42*x^5 + 104*x^6 + 252*x^7 + 592*x^8 + ...
- Alois P. Heinz, Table of n, a(n) for n = 0..3311 (terms n = 1..300 from T. D. Noe)
- Sr. Arworn, An algorithm for the number of endomorphisms on paths, Disc. Math., 309 (2009), 94-103 (see p. 95).
- Zhicong Lin and Jiang Zeng, On the number of congruence classes of paths, arXiv preprint arXiv:1112.4026 [math.CO], 2011.
- M. A. Michels and U. Knauer, The congruence classes of paths and cycles, Discr. Math., 309 (2009), 5352-5359. See p. 5356. [From _N. J. A. Sloane_, Sep 20 2009]
- Joseph Myers, BMO 2008-2009 Round 1 Problem 1-Generalisation
-
p:= 0; paths := proc(m, n, s, t) global p; if(((t+1) <= m) and s <= (n)) then paths(m,n,s+1,t+1); end if; if(((t-1) > 0) and s <= (n)) then paths(m,n,s+1,t-1); end if; if(s = n) then p:=p+1; end if; end proc; sumpaths:=proc(j) global p; p:=0; sp:=0; for h from 1 to j do p:=0; paths(j,j,1,h); sp:=sp+ p ; end do; sp; end proc; for l from 1 to 50 do sumpaths(l); end do; # Ben Paul Thurston, Oct 04 2006
# second Maple program:
a:= proc(n) option remember;
`if`(n<5, [1, 1, 2, 6, 16][n+1], ((2*n^2-6*n-4) *a(n-1)
+(56-32*n+4*n^2) *a(n-2) -8*(n-3)^2 *a(n-3))/ ((n-1)*(n-4)))
end:
seq(a(n), n=0..30); # Alois P. Heinz, Nov 23 2012
-
a[n_] := a[n] = If[n <= 4, n*((n-3)*n+4)/2, ((2*n^2 - 6*n - 4)*a[n-1] + (4*n^2 - 32*n + 56)*a[n-2] - 8*(n-3)^2*a[n-3])/((n-1)*(n-4))]; Table[ a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 10 2015, after Alois P. Heinz *)
-
x='x+O('x^55); Vec(x*(2*(1-x)-sqrt(1-4*x^2))/(1-2*x)^2) \\ Altug Alkan, Nov 10 2015
-
from math import comb
def A102699(n): return ((n+1<>1) if n&1 else (n-1)*comb(n-2,n-2>>1)<<2)) if n else 1 # Chai Wah Wu, Oct 28 2024
Showing 1-2 of 2 results.
Comments