cp's OEIS Frontend

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.

A332273 Sizes of maximal weakly decreasing subsequences of A000002.

Original entry on oeis.org

1, 4, 2, 3, 4, 3, 3, 3, 2, 4, 3, 2, 3, 4, 2, 3, 3, 3, 3, 4, 2, 3, 4, 3, 2, 3, 3, 3, 4, 2, 3, 4, 3, 3, 3, 2, 3, 4, 3, 2, 4, 3, 3, 3, 3, 3, 4, 2, 3, 3, 3, 3, 3, 3, 3, 4, 2, 3, 3, 3, 3, 3, 2, 4, 3, 2, 3, 3, 3, 4, 2, 3, 4, 3, 2, 4, 3, 3, 3, 3, 2, 4, 3, 3, 3, 3, 3
Offset: 1

Views

Author

Gus Wiseman, Mar 08 2020

Keywords

Examples

			The weakly decreasing subsequences begin: (1), (2,2,1,1), (2,1), (2,2,1), (2,2,1,1), (2,1,1), (2,2,1), (2,1,1), (2,1), (2,2,1,1), (2,1,1), (2,1), (2,2,1), (2,2,1,1).
		

Crossrefs

The number of runs in the first n terms of A000002 is A156253.
The weakly increasing version is A332875.

Programs

  • Mathematica
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=Nest[kolagrow,{1},n-1];
    Length/@Split[kol[40],#1>=#2&]

Formula

a(n) = A000002(2*n - 2) + A000002(2*n - 1) for n > 1.