login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A221235 Number of nonnegative integer arrays of length n summing to n without adjacent equal values. 3

%I #15 Apr 28 2022 07:53:51

%S 1,1,2,7,14,30,76,188,444,1075,2656,6504,15926,39316,97252,240597,

%T 596686,1482971,3689768,9191590,22927718,57253334,143101896,358003469,

%U 896391914,2246149936,5632310800,14132640565,35483595966,89141668532,224061612932,563473301874

%N Number of nonnegative integer arrays of length n summing to n without adjacent equal values.

%H Alois P. Heinz, <a href="/A221235/b221235.txt">Table of n, a(n) for n = 0..500</a> (first 210 terms from R. H. Hardin)

%F a(n) = A106351(2n,n). - _Alois P. Heinz_, Oct 12 2017

%e All solutions for n=3

%e ..1....2....0....2....0....0....1

%e ..2....1....3....0....2....1....0

%e ..0....0....0....1....1....2....2

%p b:= proc(n, h, t) option remember; `if`(t<2, `if`(n<>h, 1, 0),

%p add(`if`(h=j, 0, b(n-j, `if`(j>n-j, -1, j), t-1)), j=0..n))

%p end:

%p a:= n-> b(n, -1, n):

%p seq(a(n), n=0..35); # _Alois P. Heinz_, Oct 15 2017

%t b[n_, h_, t_] := b[n, h, t] = If[t < 2, If[n != h, 1, 0],

%t Sum[If[h == j, 0, b[n-j, If[j > n-j, -1, j], t-1]], {j, 0, n}]];

%t a[n_] := b[n, -1, n];

%t Table[a[n], {n, 0, 35}] (* _Jean-François Alcover_, Apr 28 2022, after _Alois P. Heinz_ *)

%Y Cf. A106351.

%K nonn

%O 0,3

%A _R. H. Hardin_, Jan 10 2013

%E a(0)=1 prepended by _Alois P. Heinz_, Oct 15 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 29 03:03 EST 2023. Contains 367422 sequences. (Running on oeis4.)