Loading ...
Sorry, an error occurred while loading the content.

39278Re: how can I count sets of numbers?

Expand Messages
  • visualsorte
    Oct 4, 2009
    • 0 Attachment
      If this is for a lottery, I can help you.

      Supose each combination is a string like this:
      03 09 19 34 47 49
      and they are in comb$().

      Total combination is in a variable named totcb


      'begin

      comb$(1) = "03 09 19 34 47 49"
      comb$(2) = "05 11 25 33 41 45"
      comb$(3) = "10 19 22 36 38 49"
      comb$(4) = "01 04 17 25 26 49"
      comb$(5) = "15 19 29 34 47 49"

      totcb = 5

      for p = 1 to totcb - 1
      for s = p + 1 to totcb
      equal = 0
      for k = 1 to 17 step 3
      for j = 1 to 17 step 3
      if mid$(comb$(p),k,2) = mid$(comb$(s),j,2) then equal = equal + 1
      next j
      next k

      print p; " and "; s; " equal = ";equal

      next s
      next p

      'end


      If you have any doubt, please email me : visualsorte@...





      --- In libertybasic@yahoogroups.com, "dovejurgen" <dovejurgen@...> wrote:
      >
      >
      > This is for a lottery.
      >
      > Another example:
      >
      > A1,B1,F1,H1,M1,Y1 are generating numbers for a pick 6.
      > Let's say:
      >
      > A1=5
      > B1=12
      > F1=7
      > H1=20
      > M1=21
      > Y1=40
      >
      > Eveythime, the 6 numbers are changing.It can be anything.
      > It's a little bit random.
      > I call the 6 numbers a ticket.
      >
      > I make a ticket.
      > Then it's going through filters and at the end,it returns back to the beginning to make another ticket with other numbers for doing the same thing.
      > I count the tickets.
      >
      > That's the reason why I wrote:
      > IF counter=1 THEN A1=5
      > IF counter=1 THEN B1=12
      > IF counter=1 THEN F1=7
      > IF counter=1 THEN H1=20
      > IF counter=1 THEN M1=21
      > IF counter=1 THEN Y1=40
      >
      > I think to make 100 tickets.(That means 100 tickets of 6 numbers each).
      >
      > Only after a ticket is generated I can see what the numbers are.
      >
      >
      > In this example I made 7 tickets
      > You can see that some tickets have some same numbers
      >
      >
      > IF counter=1 THEN A1=5
      > IF counter=1 THEN B1=12
      > IF counter=1 THEN F1=7
      > IF counter=1 THEN H1=20
      > IF counter=1 THEN M1=21
      > IF counter=1 THEN Y1=40
      >
      > IF counter=2 THEN A1=5
      > IF counter=2 THEN B1=12
      > IF counter=2 THEN F1=20
      > IF counter=2 THEN H1=22
      > IF counter=2 THEN M1=21
      > IF counter=2 THEN Y1=40
      >
      > IF counter=3 THEN A1=10
      > IF counter=3 THEN B1=2
      > IF counter=3 THEN F1=31
      > IF counter=3 THEN H1=3
      > IF counter=3 THEN M1=23
      > IF counter=3 THEN Y1=12
      >
      > IF counter=4 THEN A1=1
      > IF counter=4 THEN B1=2
      > IF counter=4 THEN F1=3
      > IF counter=4 THEN H1=23
      > IF counter=4 THEN M1=25
      > IF counter=4 THEN Y1=31
      >
      > IF counter=5 THEN A1=5
      > IF counter=5 THEN B1=12
      > IF counter=5 THEN F1=20
      > IF counter=5 THEN H1=22
      > IF counter=5 THEN M1=40
      > IF counter=5 THEN Y1=21
      >
      > IF counter=6 THEN A1=10
      > IF counter=6 THEN B1=2
      > IF counter=6 THEN F1=31
      > IF counter=6 THEN H1=3
      > IF counter=6 THEN M1=23
      > IF counter=6 THEN Y1=12
      >
      > IF counter=7 THEN A1=1
      > IF counter=7 THEN B1=2
      > IF counter=7 THEN F1=3
      > IF counter=7 THEN H1=23
      > IF counter=7 THEN M1=25
      > IF counter=7 THEN Y1=31
      >
      >
      > I don't want to know if there is a double ticket.
      > Because that means that I must looking for six same numbers.
      > (I only want to know 4 same numbers or 5 same numbers)
      >
      > For some reason I want to count the tickets that has exactly the same four numbers in it.
      > In this example:
      > Ticket 1 and 2 and 5 has the same 4 numbers.5,12,20,21
      > Ticket 2 and Ticket 5 has the same 4 numbers 20,22,21,40
      >
      > And I also want to count all the tickets that has exactly five same numbers
      >
      > So every ticket must be compared to all tickets.
      >
      > To discribe it in other words:
      >
      > I want to compare ticket 1 with ticket 2 to see if there are 4 same numbers in both.
      > Then compare ticket 1 with ticket 3
      > Then compare ticket 1 with ticket 4 .. till the last ticket.
      >
      > Then comparing four other numbers from ticket 1 to all the tickets.
      > Then doing the same with ticket 2.
      >
      > (In fact every ticket has sets of four number combinations).
      >
      > (If I am looking for five same numbers,every ticket has sets of five number combinations).
      >
      > If I want to know the four same numbers in each ticket,
      > imagine that it makes all possible
      > combinations of 4 numbers from ticket 1. (I think 15 possible)
      > 1234
      > 1235
      > 1236
      > 1245
      > 1246
      > 1256
      > 1345
      > 1346
      > 1356
      > 1456
      > 2345
      > 2346
      > 2356
      > 2456
      > 3456
      > Then compare these 15 combinations from ticket 1 to all 15 combinations of ticket 2 ,ticket 3.. ..till the last ticket.
      > After that doing the same for ticket 2.
      > That means again all 15 possible combinations from ticket 2 comparing to all 15 combinations of ticket 3,...till the last ticket.....
      > This for every 100 tickets .
      >
      > I know it's difficult but maybe it's possible to do this in a short way.
      >
    • Show all 10 messages in this topic