If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Lottery Numbers Generator (LNG)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #16 (permalink)  
Old
Registered User
 
Join Date: Jan 2010
Posts: 335
Quote:
Originally Posted by Lenny77 View Post
I want to change my generator to get generated numbers only if we have 2 or less for any of these numbers.
Lenny
Why do you want to do that? These combinations have the same likelihood than any other conbination. Instead you should avoid numbers smaller than 31, because People often choose birthdays. So there is a higher chance that somebody has the same Combination you choosed.
Reply With Quote
  #17 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Exclamation Good move

Quote:
Originally Posted by nvk@vhv View Post
Why do you want to do that? These combinations have the same likelihood than any other conbination. Instead you should avoid numbers smaller than 31, because People often choose birthdays. So there is a higher chance that somebody has the same Combination you choosed.
Yes, you are absolutely right !
That's why I said "I want to do it"....

You can use any of them. All depend on your luck, only.

Lenny
Reply With Quote
  #18 (permalink)  
Old
Registered User
 
Join Date: Jan 2010
Posts: 335
My professor for 'probabilistic theory' always recommend to play lottery, because this means higher tax-income which saves his job.
Reply With Quote
  #19 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Thumbs up Time Machine

Quote:
Originally Posted by nvk@vhv View Post
My professor for 'probabilistic theory' always recommend to play lottery, because this means higher tax-income which saves his job.
Your professor is smart man !

The best way to win is have a Personal Time Machine.

Lenny
Reply With Quote
  #20 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Inline Sorted Output For MegaMillions

Inline Sorted Output For MegaMillions:

Code:
with past_lot_win_int (S1, S2, S3, S4, S5, SS) as
(
select 10,20,45,51,53,41 from sysibm.sysdummy1 union all
select 06,07,26,27,49,09 from sysibm.sysdummy1 union all
select 01,10,22,23,38,19 from sysibm.sysdummy1 union all
select 07,08,38,39,48,22 from sysibm.sysdummy1 union all
select 08,13,27,28,52,09 from sysibm.sysdummy1 union all
select 04,05,34,38,41,18 from sysibm.sysdummy1 union all
select 04,07,19,21,38,29 from sysibm.sysdummy1 union all
select 05,09,31,37,56,16 from sysibm.sysdummy1 union all
select 18,20,31,36,43,33 from sysibm.sysdummy1 union all
select 13,28,39,50,55,10 from sysibm.sysdummy1 union all
select 06,08,27,40,41,21 from sysibm.sysdummy1 union all
select 02,05,29,35,51,03 from sysibm.sysdummy1 union all
select 04,16,44,52,54,20 from sysibm.sysdummy1 union all
select 03,33,35,39,45,13 from sysibm.sysdummy1 union all
select 10,20,30,44,49,24 from sysibm.sysdummy1 union all
select 27,31,32,36,47,35 from sysibm.sysdummy1 union all
select 02,21,27,34,44,45 from sysibm.sysdummy1 union all
select 20,23,28,30,46,29 from sysibm.sysdummy1 union all
select 04,33,41,51,56,38 from sysibm.sysdummy1 union all
select 17,30,39,52,53,21 from sysibm.sysdummy1 union all
select 12,25,37,39,45,11 from sysibm.sysdummy1 union all
select 10,11,35,37,50,12 from sysibm.sysdummy1 union all
select 03,04,07,16,56,39 from sysibm.sysdummy1 union all
select 08,22,27,49,50,28 from sysibm.sysdummy1 union all
select 27,43,45,49,54,44 from sysibm.sysdummy1 union all
select 08,21,29,34,37,15 from sysibm.sysdummy1 union all
select 07,11,27,40,46,08 from sysibm.sysdummy1 union all
select 05,18,23,31,38,20 from sysibm.sysdummy1 union all
select 04,15,17,29,38,20 from sysibm.sysdummy1 union all
select 07,13,37,46,51,02 from sysibm.sysdummy1 union all
select 27,45,48,54,56,02 from sysibm.sysdummy1 union all
select 13,17,25,45,55,08 from sysibm.sysdummy1 union all
select 10,13,18,33,51,43 from sysibm.sysdummy1 union all
select 17,31,34,45,51,24 from sysibm.sysdummy1 union all
select 03,14,21,24,51,14 from sysibm.sysdummy1 union all
select 09,33,51,53,56,39 from sysibm.sysdummy1 union all
select 15,24,51,53,55,11 from sysibm.sysdummy1 union all
select 02,21,25,45,50,21 from sysibm.sysdummy1 union all
select 07,27,42,49,52,19 from sysibm.sysdummy1 union all
select 26,29,33,39,46,24 from sysibm.sysdummy1 union all
select 18,27,31,36,52,33 from sysibm.sysdummy1 union all
select 29,30,32,35,41,39 from sysibm.sysdummy1 union all
select 16,27,48,49,54,02 from sysibm.sysdummy1 union all
select 04,10,18,28,50,35 from sysibm.sysdummy1 union all
select 02,04,06,21,44,37 from sysibm.sysdummy1 union all
select 02,09,28,51,53,19 from sysibm.sysdummy1 
) 
,
past_lot_win_Ch2 (S1, S2, S3, S4, S5, SS) as
(select right(digits(S1), 2),right(digits(S2), 2),
        right(digits(S3), 2),right(digits(S4), 2), 
        right(digits(S5), 2),right(digits(SS), 2) 
   from past_lot_win_int 
)
,
Lotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, SB) as
(select int(25),int(0),int(0), 'N',
        char('', 2), char('', 2), char('', 2),   
        char('', 2), char('', 2), char('', 2)        
   from sysibm.sysdummy1 
union all
select tickets, R + 12, 
    K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
                  M4 > '00' and M5 > '00' and MB > '00' 
             then 1
             else 0
        end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
          M4 > '00' and M5 > '00' and MB > '00' 
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, MB 
from Lotto_tickets lt,
TABLE (
select max(L1) M1, max(L2) M2, max(L3) M3, 
       max(L4) M4, max(L5) M5, max(SB) MB  
from TABLE
(select  L1, L2, L3, L4, L5, SB 
from
(select  L1, L2, L3, L4, L5, SB 
from TABLE
(select 
substr(char(rand(R)),        3,  1)       ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
        substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
        substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
        substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
        substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
        substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  SB    
         
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '56' and
L2 between '01' and '56' and
L3 between '01' and '56' and
L4 between '01' and '56' and
L5 between '01' and '56' and
SB between '01' and '46' 

) rd2 
Where 
L1 < L2 and
L2 < L3 and
L3 < L4 and
L4 < L5 and
not exists
(select 1 from past_lot_win_Ch2 
where 
case when 
L1 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
L2 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
L3 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
L4 in (s1, s2, s3, s4, s5) then 1 else 0
end +
case when 
L5 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
SB = SS then 1 else 0 
end  >= 3
)Union All
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' SB 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select distinct L1, L2, L3, L4, L5, SB "MegaBall"   
  from Lotto_tickets
   where Lsw = 'Y';
Result could be like following:

Quote:
L1 L2 L3 L4 L5 MegaBall

01 19 32 38 39 42
01 29 31 38 49 28
02 07 10 23 34 09
02 19 39 52 54 08
03 14 26 38 54 20
03 15 21 28 44 46
03 37 38 48 56 15
04 20 21 28 52 04
06 16 21 23 36 11
06 25 27 39 50 15
07 11 21 26 48 35
09 13 22 29 38 45
09 20 34 36 54 28
11 36 47 52 56 18
12 29 36 37 38 45
13 17 28 30 37 40
14 19 39 45 55 24
15 22 23 32 44 04
15 22 35 39 43 08
15 28 34 44 51 04
16 26 29 35 49 40
17 28 40 47 49 32
17 38 46 50 56 45
19 20 22 29 42 35
24 40 45 47 51 31
Lenny
Reply With Quote
  #21 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Using LNG I won with 3 numbers on Friday. Not bad for start.

Lenny
Reply With Quote
  #22 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Cool Sorted Goslotto (for russian from Russia)

Code:
with Goslotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, L6) as
(select int(20),int(0),int(0), 'N',
        char('', 2), char('', 2), char('', 2),   
        char('', 2), char('', 2), char('', 2)        
   from sysibm.sysdummy1 
union all
select tickets, R + 12, 
    K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
                  M4 > '00' and M5 > '00' and M6 > '00' 
             then 1
             else 0
        end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
          M4 > '00' and M5 > '00' and M6 > '00' 
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, M6 
from Goslotto_tickets lt,
table (
select max(L1) M1, max(L2) M2, max(L3) M3, 
       max(L4) M4, max(L5) M5, max(L6) M6  
from table 
(select  L1, L2, L3, L4, L5, L6 
from table 
(select  L1, L2, L3, L4, L5, L6 
from table
(select 
substr(char(rand(R)),        3,  1)       ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
        substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
        substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
        substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
        substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
        substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  L6    
         
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '45' and
L2 between '01' and '45' and
L3 between '01' and '45' and
L4 between '01' and '45' and
L5 between '01' and '45' and
L6 between '01' and '45'  
) rd2 
Where 
L1 < L2 and
L2 < L3 and
L3 < L4 and
L4 < L5 and
L5 < L6  

union all
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' L6 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select distinct L1, L2, L3, L4, L5, L6   
  from Goslotto_tickets 
   where Lsw = 'Y';
Result:

Quote:
L1 L2 L3 L4 L5 L6

01 02 06 17 28 39
01 05 08 20 28 45
02 11 16 27 40 42
02 29 36 37 38 45
03 15 33 36 38 45
03 19 25 28 33 35
04 05 14 17 29 34
04 12 16 30 38 44
06 22 28 32 42 45
07 22 28 31 34 44
07 23 29 34 39 42
08 22 25 28 29 38
09 13 22 29 38 45
09 15 26 31 44 45
10 14 21 24 25 37
11 15 24 35 40 42
11 22 25 29 35 39
18 19 26 31 44 45
18 22 25 38 39 43
21 23 24 26 31 35
Lenny
Reply With Quote
  #23 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Exclamation MM numbers with prime number

I found out:
For get the winning set we have to have at least one prime number between selected numbers.

In this way I changed the query which have to get the winning numbers:
Code:
with past_lot_win_int (S1, S2, S3, S4, S5, SS) as
(
select 10,20,45,51,53,41 from sysibm.sysdummy1 union all
select 06,07,26,27,49,09 from sysibm.sysdummy1 union all
select 01,10,22,23,38,19 from sysibm.sysdummy1 union all
select 07,08,38,39,48,22 from sysibm.sysdummy1 union all
select 08,13,27,28,52,09 from sysibm.sysdummy1 union all
select 04,05,34,38,41,18 from sysibm.sysdummy1 union all
select 04,07,19,21,38,29 from sysibm.sysdummy1 union all
select 05,09,31,37,56,16 from sysibm.sysdummy1 union all
select 18,20,31,36,43,33 from sysibm.sysdummy1 union all
select 13,28,39,50,55,10 from sysibm.sysdummy1 union all
select 06,08,27,40,41,21 from sysibm.sysdummy1 union all
select 02,05,29,35,51,03 from sysibm.sysdummy1 union all
select 04,16,44,52,54,20 from sysibm.sysdummy1 union all
select 03,33,35,39,45,13 from sysibm.sysdummy1 union all
select 10,20,30,44,49,24 from sysibm.sysdummy1 union all
select 27,31,32,36,47,35 from sysibm.sysdummy1 union all
select 02,21,27,34,44,45 from sysibm.sysdummy1 union all
select 20,23,28,30,46,29 from sysibm.sysdummy1 union all
select 04,33,41,51,56,38 from sysibm.sysdummy1 union all
select 17,30,39,52,53,21 from sysibm.sysdummy1 union all
select 12,25,37,39,45,11 from sysibm.sysdummy1 union all
select 10,11,35,37,50,12 from sysibm.sysdummy1 union all
select 03,04,07,16,56,39 from sysibm.sysdummy1 union all
select 08,22,27,49,50,28 from sysibm.sysdummy1 union all
select 27,43,45,49,54,44 from sysibm.sysdummy1 union all
select 08,21,29,34,37,15 from sysibm.sysdummy1 union all
select 07,11,27,40,46,08 from sysibm.sysdummy1 union all
select 05,18,23,31,38,20 from sysibm.sysdummy1 union all
select 04,15,17,29,38,20 from sysibm.sysdummy1 union all
select 07,13,37,46,51,02 from sysibm.sysdummy1 union all
select 27,45,48,54,56,02 from sysibm.sysdummy1 union all
select 13,17,25,45,55,08 from sysibm.sysdummy1 union all
select 10,13,18,33,51,43 from sysibm.sysdummy1 union all
select 17,31,34,45,51,24 from sysibm.sysdummy1 union all
select 03,14,21,24,51,14 from sysibm.sysdummy1 union all
select 09,33,51,53,56,39 from sysibm.sysdummy1 union all
select 15,24,51,53,55,11 from sysibm.sysdummy1 union all
select 02,21,25,45,50,21 from sysibm.sysdummy1 union all
select 07,27,42,49,52,19 from sysibm.sysdummy1 union all
select 26,29,33,39,46,24 from sysibm.sysdummy1 union all
select 18,27,31,36,52,33 from sysibm.sysdummy1 union all
select 29,30,32,35,41,39 from sysibm.sysdummy1 union all
select 16,27,48,49,54,02 from sysibm.sysdummy1 union all
select 04,10,18,28,50,35 from sysibm.sysdummy1 union all
select 02,04,06,21,44,37 from sysibm.sysdummy1 union all
select 02,09,28,51,53,19 from sysibm.sysdummy1 
) 
,
factors (fact) as
(select 2  from sysibm.sysdummy1 union all
 select 3  from sysibm.sysdummy1 union all
 select 5  from sysibm.sysdummy1 union all
 select 7  from sysibm.sysdummy1 
)  
,
past_lot_win_Ch2 (S1, S2, S3, S4, S5, SS) as
(select right(digits(S1), 2),right(digits(S2), 2),
        right(digits(S3), 2),right(digits(S4), 2), 
        right(digits(S5), 2),right(digits(SS), 2) 
   from past_lot_win_int 
)
,
Lotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, SB) as
(select int(20),int(0),int(0), 'N',
        char('', 2), char('', 2), char('', 2),   
        char('', 2), char('', 2), char('', 2)        
   from sysibm.sysdummy1 
union all
select tickets, R + 7, 
    K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
                  M4 > '00' and M5 > '00' and MB > '00' 
             then 1
             else 0
        end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
          M4 > '00' and M5 > '00' and MB > '00' 
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, MB 
from Lotto_tickets lt,
TABLE (
select max(L1) M1, max(L2) M2, max(L3) M3, 
       max(L4) M4, max(L5) M5, max(SB) MB  
from TABLE
(select  L1, L2, L3, L4, L5, SB 
from
(select  L1, L2, L3, L4, L5, SB 
from TABLE
(select 
substr(char(rand(R)),        3,  1)       ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
        substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
        substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
        substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
        substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
        substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  SB    
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '56' and
L2 between '22' and '56' and
L3 between '01' and '56' and
L4 between '01' and '56' and
L5 between '01' and '56' and
SB between '01' and '46' 
) rd2 
Where 
L1 not in (L2, L3, L4, L5) and
L2 not in (L1, L3, L4, L5) and
L3 not in (L1, L2, L4, L5) and
L4 not in (L1, L2, L3, L5) and
L5 not in (L1, L2, L3, L4) and 
Not Exists
(select 1 from past_lot_win_Ch2 
where 
case when 
L1 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
L2 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
L3 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
L4 in (s1, s2, s3, s4, s5) then 1 else 0
end +
case when 
L5 in (s1, s2, s3, s4, s5) then 1 else 0 
end +
case when 
SB = SS then 1 else 0 
end  >= 3
)
And  
(
not exists 
(select 1 from factors 
  where mod(int(L1), fact) = 0 and int(L1) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L2), fact) = 0 and int(L2) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L3), fact) = 0 and int(L3) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L4), fact) = 0 and int(L4) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L5), fact) = 0 and int(L5) <> fact )
)
Union All
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' SB 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select distinct L1, L2, L3, L4, L5, SB "MegaBall"   
  from Lotto_tickets
   where Lsw = 'Y'
order by 1,2,3,4,5;
Result (20 tickets):
Quote:
L1 L2 L3 L4 L5 MegaBall
01 43 07 15 35 40
04 26 35 06 31 24
11 38 22 29 37 30
19 50 25 38 39 45
21 23 25 52 14 40
21 40 56 29 07 36
24 41 28 55 06 02
24 56 01 47 11 18
27 51 32 29 37 33
29 39 56 20 25 07
30 29 51 21 11 19
33 44 53 38 08 03
34 52 29 32 19 13
35 39 52 07 37 44
36 37 11 55 04 45
36 55 52 45 37 21
45 38 23 21 39 09
47 24 10 01 39 39
48 44 30 02 37 16
53 35 11 25 31 45
Lenny

Last edited by Lenny77; 03-09-10 at 12:02.
Reply With Quote
  #24 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Exclamation Next Power Ball is $170,000,000

Next Power Ball is $170,000,000 !

Power Ball is USA lottery 5 from 59 + 1 from 39 (PB).

I have recreated my query to get numbers for Power Ball.

You can try it:

Code:
with 
factors (fact) as
(select 2  from sysibm.sysdummy1 union all
 select 3  from sysibm.sysdummy1 union all
 select 5  from sysibm.sysdummy1 union all
 select 7  from sysibm.sysdummy1 
)  
,
past_lot_win_Ch2 (S1, S2, S3, S4, S5, SS) as
(select right(digits(S1), 2),right(digits(S2), 2),
        right(digits(S3), 2),right(digits(S4), 2), 
        right(digits(S5), 2),right(digits(SS), 2) 
   from past_lot_win_int 
)
,
Lotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, SB) as
(select int(10),int(0),int(0), 'N',
        char('', 2), char('', 2), char('', 2),   
        char('', 2), char('', 2), char('', 2)        
   from sysibm.sysdummy1 
union all
select tickets, R + 7, 
    K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
                  M4 > '00' and M5 > '00' and MB > '00' 
             then 1
             else 0
        end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
          M4 > '00' and M5 > '00' and MB > '00' 
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, MB 
from Lotto_tickets lt,
TABLE (
select max(L1) M1, max(L2) M2, max(L3) M3, 
       max(L4) M4, max(L5) M5, max(SB) MB  
from TABLE
(select  L1, L2, L3, L4, L5, SB 
from
(select  L1, L2, L3, L4, L5, SB 
from TABLE
(select 
substr(char(rand(R)),        3,  1)       ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
        substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
        substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
        substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
        substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
        substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  SB    
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '59' and
L2 between '01' and '59' and
L3 between '01' and '59' and
L4 between '01' and '59' and
L5 between '01' and '59' and
SB between '01' and '39' 
) rd2 
Where 
L1 < L2 and
L2 < L3 and
L3 < L4 and
L4 < L5 and
(
not exists 
(select 1 from factors 
  where mod(int(L1), fact) = 0 and int(L1) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L2), fact) = 0 and int(L2) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L3), fact) = 0 and int(L3) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L4), fact) = 0 and int(L4) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L5), fact) = 0 and int(L5) <> fact )
)
Union All
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' SB 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select distinct L1, L2, L3, L4, L5, SB "Power Ball"   
  from Lotto_tickets
   where Lsw = 'Y'
order by 1,2,3,4,5;
Result (for 10 tickets):

Quote:
L1 L2 L3 L4 L5 Power Ball

01 15 30 47 50 26
03 14 26 38 54 20
05 07 09 35 58 11
05 19 22 44 54 20
05 22 35 39 43 08
07 13 29 44 52 14
09 11 21 22 59 28
09 12 31 46 48 27
20 44 45 51 59 30
23 37 38 48 56 15
Lenny
Reply With Quote
  #25 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
What interesting in Power Ball:
If you choose Power Play and match 5 numbers without PowerBall number, you will get $1000,000.00 instead of $200,000.00.

But for ticket you have to pay $2.00, not $1.00 as regular.

Lenny
Reply With Quote
  #26 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
If you wanna become millioner you have to play,
In democratic countries I don't see another way !

Lenny
Reply With Quote
  #27 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Thumbs up manipulating with data

We can easy manipulate with data, for example, instead of

Code:
L1 between '01' and '59' and
L2 between '01' and '59' and
L3 between '01' and '59' and
L4 between '01' and '59' and
L5 between '01' and '59' and
SB between '01' and '39'
we can use:

Code:
L1 between '01' and '12' and
L2 between '13' and '24' and
L3 between '25' and '36' and
L4 between '37' and '48' and
L5 between '49' and '59' and
SB between '01' and '39'
for PowerBall. In this case we can simply remove:

Code:
Where 
L1 not in (L2, L3, L4, L5) and
L2 not in (L1, L3, L4, L5) and
L3 not in (L1, L2, L4, L5) and
L4 not in (L1, L2, L3, L5) and
L5 not in (L1, L2, L3, L4)
Code:
with Lotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, SB) as
(select int(10),int(0),int(0), 'N',
        varchar('', 2), varchar('', 2), varchar('', 2),   
        varchar('', 2), varchar('', 2), varchar('', 2)        
   from sysibm.sysdummy1 
union all
select tickets, R + 12, 
    K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
                  M4 > '00' and M5 > '00' and MB > '00' 
             then 1
             else 0
        end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
          M4 > '00' and M5 > '00' and MB > '00' 
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, MB 
from Lotto_tickets lt,
table (
select max(L1) M1, max(L2) M2, max(L3) M3, 
       max(L4) M4, max(L5) M5, max(SB) MB  
from 
(select  L1, L2, L3, L4, L5, SB 
from
(select  L1, L2, L3, L4, L5, SB 
from
(select substr(varchar(rand(R))    ,  3,  1) ||  substr(varchar(rand(R + 1)),  4,  1)  L1, 
        substr(varchar(rand(R + 2)),  5,  1) ||  substr(varchar(rand(R + 3)),  6,  1)  L2, 
        substr(varchar(rand(R + 4)),  7,  1) ||  substr(varchar(rand(R + 5)),  8,  1)  L3, 
        substr(varchar(rand(R + 6)),  9,  1) ||  substr(varchar(rand(R + 7)),  10, 1)  L4,
        substr(varchar(rand(R + 8)),  10, 1) ||  substr(varchar(rand(R + 9)),  11, 1)  L5,
        substr(varchar(rand(R + 10)), 12, 1) ||  substr(varchar(rand(R + 11)), 13, 1)  SB    
         
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '12' and
L2 between '13' and '24' and
L3 between '25' and '36' and
L4 between '37' and '48' and
L5 between '49' and '59' and
SB between '01' and '39' 

) rd2 
union all
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' SB 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select  distinct L1, L2, L3, L4, L5, SB "Power Ball"   
  from  Lotto_tickets
  where Lsw = 'Y';
Result could look like:
Quote:
L1 L2 L3 L4 L5 Power Ball
01 13 32 47 54 25
02 17 32 48 55 04
03 18 30 47 49 34
05 16 26 39 59 30
06 23 27 47 54 01
07 21 33 45 54 11
08 13 32 38 49 33
09 23 30 48 54 33
11 16 27 46 52 30
11 22 32 47 58 03
Lenny
Reply With Quote
  #28 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Lightbulb The POWERBALL with prime numbers included

According my theory of WIN one or more numbers in set have to be prime.
The POWERBALL with prime numbers included:

Code:
with 
factors (fact) as
(select 2  from sysibm.sysdummy1 union all
 select 3  from sysibm.sysdummy1 union all
 select 5  from sysibm.sysdummy1 union all
 select 7  from sysibm.sysdummy1 
)  
,
Lotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, SB) as
(select int(10),int(0),int(0), 'N',
        varchar('', 2), varchar('', 2), varchar('', 2),   
        varchar('', 2), varchar('', 2), varchar('', 2)        
   from sysibm.sysdummy1 
union all
select tickets, R + 12, 
    K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
                  M4 > '00' and M5 > '00' and MB > '00' 
             then 1
             else 0
        end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
          M4 > '00' and M5 > '00' and MB > '00' 
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, MB 
from Lotto_tickets lt,
table (
select max(L1) M1, max(L2) M2, max(L3) M3, 
       max(L4) M4, max(L5) M5, max(SB) MB  
from 
(select  L1, L2, L3, L4, L5, SB 
from
(select  L1, L2, L3, L4, L5, SB 
from
(select substr(varchar(rand(R))    ,  3,  1) ||  substr(varchar(rand(R + 1)),  4,  1)  L1, 
        substr(varchar(rand(R + 2)),  5,  1) ||  substr(varchar(rand(R + 3)),  6,  1)  L2, 
        substr(varchar(rand(R + 4)),  7,  1) ||  substr(varchar(rand(R + 5)),  8,  1)  L3, 
        substr(varchar(rand(R + 6)),  9,  1) ||  substr(varchar(rand(R + 7)),  10, 1)  L4,
        substr(varchar(rand(R + 8)),  10, 1) ||  substr(varchar(rand(R + 9)),  11, 1)  L5,
        substr(varchar(rand(R + 10)), 12, 1) ||  substr(varchar(rand(R + 11)), 13, 1)  SB    
         
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '12' and
L2 between '13' and '24' and
L3 between '25' and '36' and
L4 between '37' and '48' and
L5 between '49' and '59' and
SB between '01' and '39' 
) rd2 
Where
(
not exists 
(select 1 from factors 
  where mod(int(L1), fact) = 0 and int(L1) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L2), fact) = 0 and int(L2) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L3), fact) = 0 and int(L3) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L4), fact) = 0 and int(L4) <> fact )
or
not exists 
(select 1 from factors 
  where mod(int(L5), fact) = 0 and int(L5) <> fact )
)
Union All
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' SB 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select  distinct L1, L2, L3, L4, L5, SB "Power Ball"   
  from  Lotto_tickets
  where Lsw = 'Y';
You can use result, or RUN query and get YOUR numbers:

Quote:
L1 L2 L3 L4 L5 Power Ball

01 15 30 47 50 26
01 16 27 46 52 30
02 16 32 39 52 26
05 15 30 46 52 03
05 20 25 39 52 29
07 17 30 48 59 07
07 19 30 48 55 14
10 13 33 44 51 23
11 15 32 44 59 18
12 17 25 38 49 10
Lenny
Reply With Quote
  #29 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Exclamation Pick 10. NY Lottery (daily)

Pick 10 from 80 (New York)

Rules:

Select 10 numbers from 1 through 80 and fill in your chosen squares as instructed on the playcard. Or save time by choosing Quick Pick and letting the computer randomly select numbers for you.

Code:
with Pick_10_NY
(tickets, R, K, Lsw, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10 ) as
(select int(20),int(0),int(0), 'N',
        char('', 2), char('', 2), char('', 2),   
        char('', 2), char('', 2), char('', 2),
        char('', 2), char('', 2), char('', 2), 
        char('', 2)               
   from sysibm.sysdummy1 
union all
select 
tickets, 
R + 20, 
    K + case when M1  > '00' and M2 > '00' and M3 > '00' and 
                  M4  > '00' and M5 > '00' and M6 > '00' and
                  M7  > '00' and M8 > '00' and M9 > '00' and
                  M10 > '00'
             then 1
             else 0
        end,
case when M1  > '00' and M2 > '00' and M3 > '00' and 
          M4  > '00' and M5 > '00' and M6 > '00' and
          M7  > '00' and M8 > '00' and M9 > '00' and
          M10 > '00'
     then 'Y'
     else 'N'
end,
M1, M2, M3, M4, M5, M6, M7, M8, M9, M10 
from Pick_10_NY lt,
table (
select max(L1)  M1, max(L2) M2, max(L3) M3, 
       max(L4)  M4, max(L5) M5, max(L6) M6, 
       max(L7)  M7, max(L8) M8, max(L9) M9,
       max(L10) M10   
from 
(select  L1, L2, L3, L4, L5, L6, L7, L8, L9, L10  
from
(select  L1, L2, L3, L4, L5, L6, L7, L8, L9, L10  
from
(select 
        substr(char(rand(R)),  3,  1)     ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
        substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
        substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
        substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
        substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
        substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  L6, 
        substr(char(rand(R + 12)), 14, 1) ||  
substr(char(rand(R + 13)), 15, 1)  L7,  
        substr(char(rand(R + 14)), 3,  1) ||  
substr(char(rand(R + 15)), 4, 1)  L8,  
        substr(char(rand(R + 16)), 5,  1) ||  
substr(char(rand(R + 17)), 6, 1)  L9, 
        substr(char(rand(R + 18)), 7,  1) ||  
substr(char(rand(R + 19)), 8, 1) L10 
from sysibm.sysdummy1 ) rd1
where 
L1  between '01' and '80' and
L2  between '01' and '80' and
L3  between '01' and '80' and
L4  between '01' and '80' and
L5  between '01' and '80' and
L6  between '01' and '80' and
L7  between '01' and '80' and
L8  between '01' and '80' and
L9  between '01' and '80' and
L10 between '01' and '80' 
) rd2 
Where 
L1  not in (L2, L3, L4, L5, L6, L7, L8, L9, L10) and
L2  not in (L1, L3, L4, L5, L6, L7, L8, L9, L10) and
L3  not in (L1, L2, L4, L5, L6, L7, L8, L9, L10) and
L4  not in (L1, L2, L3, L5, L6, L7, L8, L9, L10) and
L5  not in (L1, L2, L3, L4, L6, L7, L8, L9, L10) and
L6  not in (L1, L2, L3, L4, L5, L7, L8, L9, L10) and
L7  not in (L1, L2, L3, L4, L5, L6, L8, L9, L10) and
L8  not in (L1, L2, L3, L4, L5, L6, L7, L9, L10) and
L9  not in (L1, L2, L3, L4, L5, L6, L7, L8, L10) and
L10 not in (L1, L2, L3, L4, L5, L6, L7, L8, L9 )
union all
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' L6, 
       '00' L7, '00' L8, '00' L9, '00' L10
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select L1, L2, L3, L4, L5, L6, L7, L8, L9, L10  
  from Pick_10_NY 
   where Lsw = 'Y'
order by 1
Result:

Quote:
L1 L2 L3 L4 L5 L6 L7 L8 L9 L10
11 33 07 06 69 31 48 17 53 34
14 30 47 32 80 25 34 20 66 45
17 50 48 07 44 30 80 06 26 27
21 69 09 39 80 13 66 46 15 61
21 68 12 37 09 39 51 24 27 15
23 75 11 72 07 13 14 60 65 71
24 56 01 47 11 18 43 21 03 04
33 49 29 10 68 13 06 48 71 75
39 41 17 24 13 33 26 55 29 67
40 77 61 25 68 52 37 65 76 51
42 44 33 05 34 66 17 70 46 54
42 59 08 62 05 38 11 51 75 69
44 28 55 46 47 65 39 49 09 02
46 63 59 26 42 27 62 35 54 17
46 18 36 59 26 22 61 38 48 04
60 40 45 77 05 39 20 43 25 61
65 40 04 62 78 21 07 18 20 17
72 46 57 51 79 28 76 73 56 64
77 18 46 25 65 45 06 56 53 02
78 64 61 39 74 01 29 14 03 27
Lenny
Reply With Quote
  #30 (permalink)  
Old
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 963
Exclamation Who ever know ?

! Sensation !
!! The biggest Jackpot in History of USA !!
!!! Megaboll is 330 million dollars !!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On