Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Max Consecutive Occurrence.

  • To: mathgroup at
  • Subject: [mg47660] Re: Max Consecutive Occurrence.
  • From: Jens-Peer Kuska <kuska at>
  • Date: Wed, 21 Apr 2004 05:22:58 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <c62k0d$rhi$>
  • Reply-to: kuska at
  • Sender: owner-wri-mathgroup at



lst = {a, a, a, a, b, b, b, a, a, a, a, a, a, a, c, a, a, a, a, a, a, a,

MaxConsecutiveOccurrence[lst_, what_] := 
    Max[Length /@ Cases[Split[lst], {what ..}]]

does not what you want ??


"Robert G. Wilson v" wrote:
> Mathematica had many programmed functions which are not referenced in the
> help index. Under '?Position -> Further Examples' you will find two such
> functions, 'ConsecutiveOccurrences1' and 'ConsecutiveOccurrences2.' I
> first wish that Mathematica would index these.
> But the reason for writing is that I have a need for a function named
> 'MaxConsecutiveOccurrence' which would return the maximum consecutive
> occurrence of x in a list.
> Thank you in advance.
> Bob.

  • Prev by Date: Re: Max Consecutive Occurrence.
  • Next by Date: RE: Max Consecutive Occurrence.
  • Previous by thread: Re: Max Consecutive Occurrence.
  • Next by thread: RE: Max Consecutive Occurrence.