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 2000

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

Search the Archive

Re: Pattern Matching

  • To: mathgroup at
  • Subject: [mg24232] Re: Pattern Matching
  • From: Brian Higgins <bghiggins at>
  • Date: Tue, 4 Jul 2000 15:21:59 -0400 (EDT)
  • References: <8jrcgc$>
  • Sender: owner-wri-mathgroup at

I am sure the staticians in the mathgroup can answer your
question more precisely, but if you want a little code to visualize
what is happening, try this.

Suppose the wining ticket is

b = {39, 12, 4, 23, 25, 2}

Here is a list or random draws:

a = Table[Random[Integer, {1, 47}], {5000}, {6}];

This gives the total number of winning "tickets" in the random
sample a

TotalNumberofWinningTickets =
  Length[Select[Map[Intersection[#, b] &, a], Length[#] >= 3 &]]

This functions determines the number of winining tickets with n
correct numbers

WinningTickets[n_] :=
  Length[Select[Map[Intersection[#, b] &, a], Length[#] == n &]]

Have fun...


In article <8jrcgc$dup at>,
  Thomas Skipper <skipper at> wrote:
> O.K., I know this will seem useless and trivial to quite a few, but
> I'm just playing around here.
> Basically, what I'm doing is this:
> SeedRandom["a list"]
> Then:
> Table[Random[Integer, {1,47}], {any  number}, {6}]
> This produces a list of six numbers picked at random based on
the list
> in seed random. ( I think you can see where I'm going with this.
> friend Peter, a proffessor at Case Western whose specialty is
> Pobabilty and Statistics says I'm all wet, but his dog Bucky, who
> is usaully pretty wet, thinks I'm on to something, but He's not
> talking)
> Anyway, what I want to find is n number of cases in {list a} that
> match n numbers in {list b}. List a are the groups of six numbers
> produced by Random.
> List b are actual winning numbers.
> I tried:
> Cases[{%}, {"winning numbers"}], but this will only give me
cases that
> match all six (I think). What I want to do is match cases in list
> a(numbers produced by Random) that have 3 of six in list
> winning nubers), 4 of 6 and so on. I really want to see how many
> of six I have to produce to get any practical results, if any.
> Thanks

Sent via
Before you buy.

  • Prev by Date: Re: Building a Table with initially unknown length?
  • Next by Date: RE: Pattern Matching
  • Previous by thread: Pattern Matching
  • Next by thread: RE: Pattern Matching