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!)
A228194 Sum of lengths of longest contiguous subsequences with the same value over all s in {1,...,n}^n. 4

%I #35 Dec 20 2020 07:45:40

%S 0,1,6,45,436,5345,79716,1403689,28518736,656835633,16913175310,

%T 481496895121,15017297246832,509223994442449,18652724643726460,

%U 733989868341011325,30879549535458286096,1383134389475750109089,65714992805644764521724,3300990246208225995520681

%N Sum of lengths of longest contiguous subsequences with the same value over all s in {1,...,n}^n.

%H Alois P. Heinz, <a href="/A228194/b228194.txt">Table of n, a(n) for n = 0..200</a>

%H Project Euler, <a href="https://projecteuler.net/problem=427">Problem 427: n-sequences</a>

%F a(n) = Sum_{k=1..n} k*A228154(n,k).

%F a(n) ~ (2-exp(-1)) * n^n. - _Vaclav Kotesovec_, Sep 10 2014

%e a(2) = 6 = 2+1+1+2: [1,1], [1,2], [2,1], [2,2].

%p a:= proc(n) option remember; local b; b:=

%p proc(m, s, i) option remember; `if`(m>i or s>m, 0,

%p `if`(i=1, n, `if`(s=1, (n-1)*add(b(m, h, i-1), h=1..m),

%p b(m, s-1, i-1) +`if`(s=m, b(m-1, s-1, i-1), 0))))

%p end; forget(b);

%p add(m*add(b(m, s, n), s=1..m), m=1..n)

%p end:

%p seq(a(n), n=0..30);

%t a[n_] := a[n] = Module[{b}, b[m_, s_, i_] := b[m, s, i] = If[m>i || s>m, 0, If[i==1, n, If[s==1, (n-1) Sum[b[m, h, i-1], {h, 1, m}], b[m, s-1, i-1] + If[s==m, b[m-1, s-1, i-1], 0]]]]; Sum[m Sum[b[m, s, n], {s, 1, m}], {m, 1, n}]];

%t Table[a[n], {n, 0, 30}] (* _Jean-François Alcover_, Dec 20 2020, after _Alois P. Heinz_ *)

%Y Main diagonal of A228250.

%Y Cf. A228618.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Aug 17 2013

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 April 25 11:06 EDT 2024. Contains 371967 sequences. (Running on oeis4.)