The Official Liberty BASIC Support Group is a Public Group with 5623 members.
 The Official Liberty BASIC Support Group

 Public Group,
 5623 members
Primary Navigation
Re: how can I count sets of numbers?
Expand Messages
 0 Attachment
Here's a nudge in the right direction.
For a = 0 to 10
total = total + a
array(a) = total
print "a = "; a; " array(";a;") = "; array(a)
next a
then look in the help menu under "Case" I'm sure you'll be able to work on it from there :) 0 Attachment
Do you mean something like this?
dim A1(4,5)
for counter = 1 to 4
for D = 1 to 4
read A
A1(counter,D) =A
next D
next counter
data 5,12,7,20,21,40
data 5,12,20,22,21,40
data 10,2,31,3,23,12
data 1,2,3,23,25,31
for t = 1 to 5
T1 = T1 + A1(1,t)
next t
print T1
Gordon
 In libertybasic@yahoogroups.com, "dovejurgen" <dovejurgen@...> wrote:
>
> In this example I have 4 tickets of 6 numbers.
> But maybe I do 100 tickets.
> It's always A1,B1,F1,H1,M1,Y1 but its generating other numbers.
>
> I want to count the sets of 4 same numbers,
> and I want to count the sets of 5 same numbers.
>
> In this case are 2 sets of the same four numbers(2,3,23,31)
> and 2 sets of the same five numbers(5,12,20,21,40)
>
> But how can I count this with liberty basic and what when I have much tickets?
>
>
> 10 counter=counter+1
> IF counter=5 THEN GOTO 20
>
> A1(counter)=A1
> B1(counter)=B1
> F1(counter)=F1
> H1(counter)=H1
> M1(counter)=M1
> Y1(counter)=Y1
>
> 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
>
> GOTO 10
> 20
> END
> 0 Attachment
I don't understand.
No it's not that.
I don't know why the answer is 44.
The answer must be: exactly 5 same numbers=2 times
and exactly 4 same numbers=2 times
The second thing is that i can't use data,because before i don't know the exact 6 numbers.It's random generated.
In that example I used 4 tickets but I want to generate 10 or more. 0 Attachment
I don't understand the task in hand and I don't think other folks do either. Why not have another go at decribing what it is you are attempting with a few more examples. Take time to describe what you mean by a ticket and what you mean by a set of numbers. 0 Attachment
Are you by any chance running a lottery of sorts?
...from the world according to GaRPMorE
[Nontext portions of this message have been removed] 0 Attachment
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. 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.
>
Your message has been successfully submitted and would be delivered to recipients shortly.