MathGroup Archive 2004

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

Search the Archive

Re: Max Consecutive Occurrence.

  • To: mathgroup at
  • Subject: [mg47673] Re: Max Consecutive Occurrence.
  • From: "Mariusz Jankowski" <mjankowski at>
  • Date: Wed, 21 Apr 2004 05:23:14 -0400 (EDT)
  • Organization: University of Southern Maine
  • References: <c62k0d$rhi$>
  • Sender: owner-wri-mathgroup at

Bob, use


occur = Length/@tmp;

now, Max[occur] will give you the count, while

tmp[[ Flatten[Position[ occur, Max[ occur ] ] ] ]]

will give you the actual list(s)


>>> Robert G. Wilson v<rgwv at> 4/20/2004 3:37:49 AM >>>

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.


  • Prev by Date: UnitStep Integration Rules
  • Next by Date: Re: Max Consecutive Occurrence.
  • Previous by thread: Re: Max Consecutive Occurrence.
  • Next by thread: Re: Max Consecutive Occurrence.