All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Bit filling in 5*5 grid! (Posted on 2019-04-26) Difficulty: 4 of 5
There is a 5×5 grid in front of you. You have to fill 25 squares with only 0 and 1.

But, every pair of neighboring squares (that is not diagonally adjacent) needs to have a product equal to 0.

How many possible grids are there?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
The program below counts 37,869, a sampling (every thousandth grid shown) of which is:

0 0 0 0 0 
0 0 0 1 0 
0 0 0 0 0 
0 1 0 0 0 
1 0 0 0 0 

0 0 0 0 0 
0 0 1 0 1 
0 1 0 1 0 
0 0 1 0 0 
1 0 0 1 0 

0 0 0 0 0 
0 1 0 1 0 
0 0 1 0 0 
1 0 0 0 1 
0 0 0 1 0 

0 0 0 0 0 
1 0 0 1 0 
0 0 1 0 1 
0 0 0 0 0 
0 1 0 1 0 

0 0 0 0 1 
0 0 0 0 0 
0 1 0 1 0 
0 0 1 0 1 
0 1 0 1 0 

0 0 0 0 1 
0 0 1 0 0 
1 0 0 1 0 
0 0 0 0 1 
0 0 0 0 0 

0 0 0 0 1 
1 0 0 0 0 
0 0 1 0 0 
1 0 0 0 0 
0 1 0 1 0 

0 0 0 1 0 
0 0 0 0 0 
0 1 0 0 0 
0 0 0 0 0 
0 0 1 0 0 

0 0 0 1 0 
0 0 1 0 0 
0 1 0 1 0 
1 0 0 0 1 
0 0 1 0 0 

0 0 0 1 0 
0 1 0 0 1 
0 0 0 1 0 
1 0 1 0 1 
0 1 0 0 0 

0 0 0 1 0 
1 0 1 0 0 
0 0 0 1 0 
1 0 1 0 0 
0 1 0 0 0 

0 0 1 0 0 
0 0 0 0 1 
0 0 0 1 0 
0 0 0 0 0 
1 0 0 1 0 

0 0 1 0 0 
0 1 0 0 0 
1 0 0 0 0 
0 0 0 0 0 
1 0 1 0 0 

0 0 1 0 0 
1 0 0 0 0 
0 0 1 0 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 
0 1 0 0 0 
0 0 0 0 0 
0 1 0 0 0 
0 0 0 1 0 

1 0 1 0 0 
0 0 0 0 0 
0 1 0 0 0 
1 0 1 0 1 
0 1 0 0 0 

1 0 1 0 0 
0 0 0 1 0 
1 0 0 0 1 
0 0 1 0 0 
0 0 0 0 0 

1 0 1 0 0 
0 1 0 1 0 
1 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 

1 0 1 0 1 
0 0 0 1 0 
1 0 0 0 0 
0 0 1 0 0 
1 0 0 1 0 

In placing each bit, If the bit above and the bit to the left were both zero, the newly placed bit was tried out as both zero and one and so on in a branching tree. If either the bit above or the bit to the left was a 1, only a zero was allowed to continue on with the placements.

DefDbl A-Z
Dim crlf$, grid(5, 5), ct



Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 
 addon 1, 1
  
  
  
 Text1.Text = Text1.Text & ct & " done"
End Sub

Sub addon(row, col)
  DoEvents
  If grid(row - 1, col) = 0 And grid(row, col - 1) = 0 Then allow1 = 1 Else allow1 = 0
  r = row
  c = col + 1: If c > 5 Then c = 1: r = r + 1
  If r < 6 Then
    grid(row, col) = 0
    addon r, c
    If allow1 Then
      grid(row, col) = 1
      addon r, c
    End If
  Else
    ct = ct + 1
    If ct Mod 1000 = 0 Then
      For r = 1 To 5: For c = 1 To 5
        Text1.Text = Text1.Text & grid(r, c) & " "
      Next: Text1.Text = Text1.Text & crlf: Next: Text1.Text = Text1.Text & crlf
    End If
  End If
End Sub

Edited on April 26, 2019, 12:40 pm
  Posted by Charlie on 2019-04-26 12:39:15

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (21)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information