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 > Absolute SUDOKU Solver

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #121 (permalink)  
Old 03-24-10, 17:52
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Red face Level-3 Sudoku

Level-3 Sudoku < 0 sec >:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '140007200'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '300020001'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000900070'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '016000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '008105300'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '000000060'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '020009000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '601070008'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '009500040'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Quote:
Line 1: | 1 | 4 | 5 | 8 | 3 | 7 | 2 | 9 | 6 |
Line 2: | 3 | 9 | 7 | 4 | 2 | 6 | 8 | 5 | 1 |
Line 3: | 8 | 6 | 2 | 9 | 5 | 1 | 4 | 7 | 3 |
Line 4: | 5 | 1 | 6 | 3 | 4 | 2 | 7 | 8 | 9 |
Line 5: | 9 | 7 | 8 | 1 | 6 | 5 | 3 | 2 | 4 |
Line 6: | 2 | 3 | 4 | 7 | 9 | 8 | 1 | 6 | 5 |
Line 7: | 4 | 2 | 3 | 6 | 8 | 9 | 5 | 1 | 7 |
Line 8: | 6 | 5 | 1 | 2 | 7 | 4 | 9 | 3 | 8 |
Line 9: | 7 | 8 | 9 | 5 | 1 | 3 | 6 | 4 | 2 |
Lenny

P.S. Common Solution, using VIEW still on page 7.
Reply With Quote
  #122 (permalink)  
Old 04-13-10, 14:44
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Cool Level-4 Sudoku

Level-4 Sudoku in 0 seconds

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '000003680'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '000900001'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '096812000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '000020004'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '012309760'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '700080000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '000176590'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '200005000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '051200000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Result:

Quote:
Line 1: | 1 | 2 | 4 | 7 | 5 | 3 | 6 | 8 | 9 |
Line 2: | 3 | 7 | 8 | 9 | 6 | 4 | 2 | 5 | 1 |
Line 3: | 5 | 9 | 6 | 8 | 1 | 2 | 3 | 4 | 7 |
Line 4: | 6 | 3 | 9 | 5 | 2 | 7 | 8 | 1 | 4 |
Line 5: | 8 | 1 | 2 | 3 | 4 | 9 | 7 | 6 | 5 |
Line 6: | 7 | 4 | 5 | 6 | 8 | 1 | 9 | 2 | 3 |
Line 7: | 4 | 8 | 3 | 1 | 7 | 6 | 5 | 9 | 2 |
Line 8: | 2 | 6 | 7 | 4 | 9 | 5 | 1 | 3 | 8 |
Line 9: | 9 | 5 | 1 | 2 | 3 | 8 | 4 | 7 | 6 |
Lenny
Reply With Quote
  #123 (permalink)  
Old 04-19-10, 16:56
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Monday Sudoku

Monday Sudoku:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '980000063'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '020000900'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '600020000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '500680002'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000703000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '300054001'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '000060008'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '005000030'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '810000025'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Quote:
Line 1: | 9 | 8 | 1 | 4 | 7 | 5 | 2 | 6 | 3 |
Line 2: | 7 | 2 | 3 | 8 | 1 | 6 | 9 | 5 | 4 |
Line 3: | 6 | 5 | 4 | 3 | 2 | 9 | 8 | 1 | 7 |
Line 4: | 5 | 9 | 7 | 6 | 8 | 1 | 3 | 4 | 2 |
Line 5: | 1 | 4 | 2 | 7 | 9 | 3 | 5 | 8 | 6 |
Line 6: | 3 | 6 | 8 | 2 | 5 | 4 | 7 | 9 | 1 |
Line 7: | 4 | 3 | 9 | 5 | 6 | 2 | 1 | 7 | 8 |
Line 8: | 2 | 7 | 5 | 1 | 4 | 8 | 6 | 3 | 9 |
Line 9: | 8 | 1 | 6 | 9 | 3 | 7 | 4 | 2 | 5 |
Lenny

P.S. See an attachment on page.7
Reply With Quote
  #124 (permalink)  
Old 04-21-10, 15:20
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Red face Wednesday Sudoku

Wednesday Sudoku:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '600000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '190040052'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000302000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '005000800'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '008020300'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '001009604'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '000605000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '840070060'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '000000001'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Result:

Quote:
Line 1: | 6 | 2 | 4 | 9 | 5 | 7 | 1 | 3 | 8 |
Line 2: | 1 | 9 | 3 | 8 | 4 | 6 | 7 | 5 | 2 |
Line 3: | 5 | 8 | 7 | 3 | 1 | 2 | 9 | 4 | 6 |
Line 4: | 4 | 7 | 5 | 1 | 6 | 3 | 8 | 2 | 9 |
Line 5: | 9 | 6 | 8 | 7 | 2 | 4 | 3 | 1 | 5 |
Line 6: | 2 | 3 | 1 | 5 | 8 | 9 | 6 | 7 | 4 |
Line 7: | 3 | 1 | 2 | 6 | 9 | 5 | 4 | 8 | 7 |
Line 8: | 8 | 4 | 9 | 2 | 7 | 1 | 5 | 6 | 3 |
Line 9: | 7 | 5 | 6 | 4 | 3 | 8 | 2 | 9 | 1 |
Lenny
Reply With Quote
  #125 (permalink)  
Old 04-23-10, 15:11
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Friday Sudoku

Friday Apr 23 2010 Sudoku:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '640900030'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '000000010'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000400200'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '010000005'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000067004'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '500030090'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '007004000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '030000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '090000827'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Quote:
Line 1: | 6 | 4 | 1 | 9 | 7 | 2 | 5 | 3 | 8 |
Line 2: | 9 | 7 | 2 | 3 | 8 | 5 | 4 | 1 | 6 |
Line 3: | 8 | 5 | 3 | 4 | 1 | 6 | 2 | 7 | 9 |
Line 4: | 7 | 1 | 8 | 2 | 4 | 9 | 3 | 6 | 5 |
Line 5: | 3 | 2 | 9 | 5 | 6 | 7 | 1 | 8 | 4 |
Line 6: | 5 | 6 | 4 | 8 | 3 | 1 | 7 | 9 | 2 |
Line 7: | 1 | 8 | 7 | 6 | 2 | 4 | 9 | 5 | 3 |
Line 8: | 2 | 3 | 5 | 7 | 9 | 8 | 6 | 4 | 1 |
Line 9: | 4 | 9 | 6 | 1 | 5 | 3 | 8 | 2 | 7 |
Lenny
Reply With Quote
  #126 (permalink)  
Old 04-29-10, 16:15
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Talking Just Sudoku

Sudoku <27 start numbers>:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '001000600'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '740503000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '900000032'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '010020000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '600805007'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '000040010'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '420000003'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '030207061'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '009000500'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Sudoku solved:

Quote:
Line 1: | 3 | 8 | 1 | 9 | 7 | 2 | 6 | 5 | 4 |
Line 2: | 7 | 4 | 2 | 5 | 6 | 3 | 1 | 8 | 9 |
Line 3: | 9 | 6 | 5 | 4 | 8 | 1 | 7 | 3 | 2 |
Line 4: | 8 | 1 | 4 | 7 | 2 | 6 | 3 | 9 | 5 |
Line 5: | 6 | 9 | 3 | 8 | 1 | 5 | 2 | 4 | 7 |
Line 6: | 2 | 5 | 7 | 3 | 4 | 9 | 8 | 1 | 6 |
Line 7: | 4 | 2 | 6 | 1 | 5 | 8 | 9 | 7 | 3 |
Line 8: | 5 | 3 | 8 | 2 | 9 | 7 | 4 | 6 | 1 |
Line 9: | 1 | 7 | 9 | 6 | 3 | 4 | 5 | 2 | 8 |
Lenny
Reply With Quote
  #127 (permalink)  
Old 04-30-10, 11:58
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Talking Friday Level-4 Sudoku

Friday Level-4 Sudoku <3 seconds>:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '003050000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '705200300'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000008001'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '801000500'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '090805020'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '006900103'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '500100000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '008007600'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '000030200'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
And using:
Code:
Select sudoku_solution from SDVW_SOLUTION
We get the result:

Quote:
Line 1: | 1 | 6 | 3 | 7 | 5 | 4 | 8 | 9 | 2 |
Line 2: | 7 | 8 | 5 | 2 | 9 | 1 | 3 | 6 | 4 |
Line 3: | 2 | 4 | 9 | 3 | 6 | 8 | 7 | 5 | 1 |
Line 4: | 8 | 2 | 1 | 6 | 4 | 3 | 5 | 7 | 9 |
Line 5: | 3 | 9 | 7 | 8 | 1 | 5 | 4 | 2 | 6 |
Line 6: | 4 | 5 | 6 | 9 | 7 | 2 | 1 | 8 | 3 |
Line 7: | 5 | 3 | 2 | 1 | 8 | 6 | 9 | 4 | 7 |
Line 8: | 9 | 1 | 8 | 4 | 2 | 7 | 6 | 3 | 5 |
Line 9: | 6 | 7 | 4 | 5 | 3 | 9 | 2 | 1 | 8 |
Lenny
Reply With Quote
  #128 (permalink)  
Old 05-13-10, 14:40
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Wink Sudoku Level-4 AMNY

Sudoku Level-4 AMNY << 0 sec >>:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '004000700'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '290005000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '600000800'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '510203060'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000060000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '060900017'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '001000002'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '000308051'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '008000300'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Result:

Quote:
Line 1: | 1 | 8 | 4 | 6 | 3 | 9 | 7 | 2 | 5 |
Line 2: | 2 | 9 | 7 | 4 | 8 | 5 | 1 | 3 | 6 |
Line 3: | 6 | 3 | 5 | 7 | 1 | 2 | 8 | 4 | 9 |
Line 4: | 5 | 1 | 9 | 2 | 7 | 3 | 4 | 6 | 8 |
Line 5: | 4 | 7 | 2 | 8 | 6 | 1 | 5 | 9 | 3 |
Line 6: | 8 | 6 | 3 | 9 | 5 | 4 | 2 | 1 | 7 |
Line 7: | 3 | 4 | 1 | 5 | 9 | 7 | 6 | 8 | 2 |
Line 8: | 7 | 2 | 6 | 3 | 4 | 8 | 9 | 5 | 1 |
Line 9: | 9 | 5 | 8 | 1 | 2 | 6 | 3 | 7 | 4 |
Lenny <<page 7>>

Last edited by Lenny77; 05-19-10 at 14:10.
Reply With Quote
  #129 (permalink)  
Old 05-19-10, 14:09
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Sudoku Level: HARD

Sudoku Level: HARD <0 sec>:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '009000654'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '420000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '700405000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '210057000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '008601400'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '000920085'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '000108006'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '000000091'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '841000700'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Result:

Quote:
Line 1: | 1 | 3 | 9 | 7 | 8 | 2 | 6 | 5 | 4 |
Line 2: | 4 | 2 | 5 | 3 | 1 | 6 | 9 | 7 | 8 |
Line 3: | 7 | 8 | 6 | 4 | 9 | 5 | 2 | 1 | 3 |
Line 4: | 2 | 1 | 4 | 8 | 5 | 7 | 3 | 6 | 9 |
Line 5: | 9 | 5 | 8 | 6 | 3 | 1 | 4 | 2 | 7 |
Line 6: | 6 | 7 | 3 | 9 | 2 | 4 | 1 | 8 | 5 |
Line 7: | 3 | 9 | 2 | 1 | 7 | 8 | 5 | 4 | 6 |
Line 8: | 5 | 6 | 7 | 2 | 4 | 3 | 8 | 9 | 1 |
Line 9: | 8 | 4 | 1 | 5 | 6 | 9 | 7 | 3 | 2 |
Lenny
Reply With Quote
  #130 (permalink)  
Old 05-21-10, 15:14
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Friday 05/21/10: Two Very Hard Sudokus

Level-4 Sudoku. AMNY 05/21/2010 <5 sec>:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '790030400'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '058000200'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000000006'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '900010008'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000987000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '200050007'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '300000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '029000840'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '006020059'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Where result:

Quote:
Line 1: | 7 | 9 | 2 | 6 | 3 | 8 | 4 | 1 | 5 |
Line 2: | 6 | 5 | 8 | 1 | 4 | 9 | 2 | 7 | 3 |
Line 3: | 4 | 1 | 3 | 5 | 7 | 2 | 9 | 8 | 6 |
Line 4: | 9 | 6 | 7 | 2 | 1 | 4 | 5 | 3 | 8 |
Line 5: | 1 | 3 | 5 | 9 | 8 | 7 | 6 | 2 | 4 |
Line 6: | 2 | 8 | 4 | 3 | 5 | 6 | 1 | 9 | 7 |
Line 7: | 3 | 4 | 1 | 8 | 9 | 5 | 7 | 6 | 2 |
Line 8: | 5 | 2 | 9 | 7 | 6 | 3 | 8 | 4 | 1 |
Line 9: | 8 | 7 | 6 | 4 | 2 | 1 | 3 | 5 | 9 |
Sudoku Level: Hard Metro NY 05/21/2010 <0 sec>:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '002059100'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '140080000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '003004008'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '200093080'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '008000500'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '050720003'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '500400600'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '000060041'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '006930800'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Result:

Quote:
Line 1: | 8 | 7 | 2 | 3 | 5 | 9 | 1 | 6 | 4 |
Line 2: | 1 | 4 | 5 | 6 | 8 | 7 | 3 | 9 | 2 |
Line 3: | 9 | 6 | 3 | 2 | 1 | 4 | 7 | 5 | 8 |
Line 4: | 2 | 1 | 7 | 5 | 9 | 3 | 4 | 8 | 6 |
Line 5: | 3 | 9 | 8 | 1 | 4 | 6 | 5 | 2 | 7 |
Line 6: | 6 | 5 | 4 | 7 | 2 | 8 | 9 | 1 | 3 |
Line 7: | 5 | 8 | 1 | 4 | 7 | 2 | 6 | 3 | 9 |
Line 8: | 7 | 3 | 9 | 8 | 6 | 5 | 2 | 4 | 1 |
Line 9: | 4 | 2 | 6 | 9 | 3 | 1 | 8 | 7 | 5 |
Lenny
P.S. See an attachment on page 7 of current topic, if you want to
KNOW HOW
Reply With Quote
  #131 (permalink)  
Old 05-27-10, 02:12
hppyclnr1978 hppyclnr1978 is offline
Registered User
 
Join Date: May 2010
Posts: 1
wow I didn't even know this was possible. I guess nothing is out of reach
Reply With Quote
  #132 (permalink)  
Old 06-03-10, 11:43
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Find Solutions for irregular Sudoku

Using our view we can solve Sudoku which has more than 1 solution:

Quote:
select max(sd_id) from final table
(insert into Sd_Source
select ifnull(max(sd_id), 0) + 1, 1, '001000600'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 2, '040503000'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 3, '000000032'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 4, '010020000'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 5, '600805007'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 6, '000040010'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 7, '420000003'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 8, '030207061'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
union all
select ifnull(max(sd_id), 0) + 1, 9, '009000500'
, ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
from Sd_Source
);
Results:


Quote:
Line 1: | 3 | 8 | 1 | 9 | 7 | 2 | 6 | 5 | 4 |
Line 2: | 7 | 4 | 2 | 5 | 6 | 3 | 1 | 8 | 9 |
Line 3: | 9 | 6 | 5 | 4 | 8 | 1 | 7 | 3 | 2 |
Line 4: | 8 | 1 | 4 | 7 | 2 | 6 | 3 | 9 | 5 |
Line 5: | 6 | 9 | 3 | 8 | 1 | 5 | 2 | 4 | 7 |
Line 6: | 2 | 5 | 7 | 3 | 4 | 9 | 8 | 1 | 6 |
Line 7: | 4 | 2 | 6 | 1 | 5 | 8 | 9 | 7 | 3 |
Line 8: | 5 | 3 | 8 | 2 | 9 | 7 | 4 | 6 | 1 |
Line 9: | 1 | 7 | 9 | 6 | 3 | 4 | 5 | 2 | 8 |
Quote:
Line 1: | 3 | 8 | 1 | 9 | 7 | 2 | 6 | 5 | 4 |
Line 2: | 2 | 4 | 7 | 5 | 6 | 3 | 1 | 8 | 9 |
Line 3: | 9 | 6 | 5 | 4 | 8 | 1 | 7 | 3 | 2 |
Line 4: | 8 | 1 | 4 | 7 | 2 | 6 | 3 | 9 | 5 |
Line 5: | 6 | 9 | 3 | 8 | 1 | 5 | 2 | 4 | 7 |
Line 6: | 7 | 5 | 2 | 3 | 4 | 9 | 8 | 1 | 6 |
Line 7: | 4 | 2 | 6 | 1 | 5 | 8 | 9 | 7 | 3 |
Line 8: | 5 | 3 | 8 | 2 | 9 | 7 | 4 | 6 | 1 |
Line 9: | 1 | 7 | 9 | 6 | 3 | 4 | 5 | 2 | 8 |
Quote:
Line 1: | 3 | 8 | 1 | 9 | 7 | 2 | 6 | 5 | 4 |
Line 2: | 2 | 4 | 7 | 5 | 6 | 3 | 1 | 8 | 9 |
Line 3: | 9 | 6 | 5 | 4 | 8 | 1 | 7 | 3 | 2 |
Line 4: | 7 | 1 | 4 | 3 | 2 | 6 | 8 | 9 | 5 |
Line 5: | 6 | 9 | 3 | 8 | 1 | 5 | 2 | 4 | 7 |
Line 6: | 8 | 5 | 2 | 7 | 4 | 9 | 3 | 1 | 6 |
Line 7: | 4 | 2 | 6 | 1 | 5 | 8 | 9 | 7 | 3 |
Line 8: | 5 | 3 | 8 | 2 | 9 | 7 | 4 | 6 | 1 |
Line 9: | 1 | 7 | 9 | 6 | 3 | 4 | 5 | 2 | 8 |
Quote:
Line 1: | 3 | 8 | 1 | 9 | 7 | 2 | 6 | 5 | 4 |
Line 2: | 2 | 4 | 7 | 5 | 6 | 3 | 1 | 8 | 9 |
Line 3: | 9 | 6 | 5 | 4 | 8 | 1 | 7 | 3 | 2 |
Line 4: | 7 | 1 | 4 | 3 | 2 | 6 | 8 | 9 | 5 |
Line 5: | 6 | 9 | 2 | 8 | 1 | 5 | 3 | 4 | 7 |
Line 6: | 8 | 5 | 3 | 7 | 4 | 9 | 2 | 1 | 6 |
Line 7: | 4 | 2 | 6 | 1 | 5 | 8 | 9 | 7 | 3 |
Line 8: | 5 | 3 | 8 | 2 | 9 | 7 | 4 | 6 | 1 |
Line 9: | 1 | 7 | 9 | 6 | 3 | 4 | 5 | 2 | 8 |

All solutions are good. There are no mistake. You can check.

Lenny
Reply With Quote
  #133 (permalink)  
Old 06-09-10, 17:00
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Talking Wednesday Sudoku

Wednesday Sudoku (06/09/10 -- AMNY)

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '420300005'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '500070800'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000000009'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '030708000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '008139070'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '200000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '006040008'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '700060001'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Result:

Quote:
Line 1: | 4 | 2 | 9 | 3 | 8 | 6 | 7 | 1 | 5 |
Line 2: | 5 | 6 | 1 | 9 | 7 | 2 | 8 | 3 | 4 |
Line 3: | 8 | 7 | 3 | 4 | 1 | 5 | 6 | 2 | 9 |
Line 4: | 1 | 3 | 2 | 7 | 5 | 8 | 4 | 9 | 6 |
Line 5: | 9 | 5 | 7 | 6 | 2 | 4 | 1 | 8 | 3 |
Line 6: | 6 | 4 | 8 | 1 | 3 | 9 | 5 | 7 | 2 |
Line 7: | 2 | 8 | 4 | 5 | 9 | 1 | 3 | 6 | 7 |
Line 8: | 3 | 1 | 6 | 2 | 4 | 7 | 9 | 5 | 8 |
Line 9: | 7 | 9 | 5 | 8 | 6 | 3 | 2 | 4 | 1 |
Lenny (For more infornation look at page 7 of current topic)
Reply With Quote
  #134 (permalink)  
Old 06-16-10, 10:32
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Thumbs up Beautiful Sudoku

Beautiful Sudoku: 26 start numbers + 2 empty lines:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '046102000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '732000840'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '000000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '000004638'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000007000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '581200000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '000000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '004000256'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '000901480'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);

select sudoku_solution from SDVW_SOLUTION;
We get the Result in 2 seconds:

Quote:
Line 1: | 8 | 4 | 6 | 1 | 7 | 2 | 5 | 9 | 3 |
Line 2: | 7 | 3 | 2 | 6 | 5 | 9 | 8 | 4 | 1 |
Line 3: | 1 | 5 | 9 | 3 | 4 | 8 | 7 | 6 | 2 |
Line 4: | 2 | 9 | 7 | 5 | 1 | 4 | 6 | 3 | 8 |
Line 5: | 4 | 6 | 3 | 8 | 9 | 7 | 1 | 2 | 5 |
Line 6: | 5 | 8 | 1 | 2 | 3 | 6 | 9 | 7 | 4 |
Line 7: | 6 | 7 | 8 | 4 | 2 | 5 | 3 | 1 | 9 |
Line 8: | 9 | 1 | 4 | 7 | 8 | 3 | 2 | 5 | 6 |
Line 9: | 3 | 2 | 5 | 9 | 6 | 1 | 4 | 8 | 7 |
Lenny

P.S. You can check result in tomorrow AMNY newspaper
Reply With Quote
  #135 (permalink)  
Old 06-22-10, 11:55
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Exclamation Solving Sudoku by using methods on page 7

Hard Sudoku (25 start numbers, only):


Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '007500402'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '021000700'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '090670000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '040800020'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000030000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '030007000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '000061090'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '006000310'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '302000500'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);

select sudoku_solution from SDVW_SOLUTION;
And in ZERO seconds we have result:


Quote:
Line 1: | 6 | 8 | 7 | 5 | 1 | 9 | 4 | 3 | 2 |
Line 2: | 5 | 2 | 1 | 4 | 8 | 3 | 7 | 6 | 9 |
Line 3: | 4 | 9 | 3 | 6 | 7 | 2 | 8 | 5 | 1 |
Line 4: | 7 | 4 | 9 | 8 | 5 | 6 | 1 | 2 | 3 |
Line 5: | 2 | 6 | 8 | 1 | 3 | 4 | 9 | 7 | 5 |
Line 6: | 1 | 3 | 5 | 9 | 2 | 7 | 6 | 8 | 4 |
Line 7: | 8 | 5 | 4 | 3 | 6 | 1 | 2 | 9 | 7 |
Line 8: | 9 | 7 | 6 | 2 | 4 | 5 | 3 | 1 | 8 |
Line 9: | 3 | 1 | 2 | 7 | 9 | 8 | 5 | 4 | 6 |
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