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

Home > Just Math
Binary Palindrome Square Magic (Posted on 2015-12-24) Difficulty: 3 of 5
Find a 4x4 magic square with magic constant being 188 (base ten) and each of whose 16 entries is a non leading zeroes positive binary palindrome.

*** Disregard rotations and reflections.

See The Solution Submitted by K Sengupta    
Rating: 4.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: No Subject | Comment 2 of 11 |
(In reply to No Subject by Ady TZIDON)

If repetitions are allowed, as assumed in the first post, then of course any permutation of the 4 given numbers will work as assignments to the placeholders a, b, c and d, as will have any permutation of any one of these 139 sets:


1 1 21 165 
1 1 33 153 
1 1 93 93 
1 3 31 153 
1 3 65 119 
1 3 85 99 
1 5 17 165 
1 5 63 119 
1 7 15 165 
1 7 27 153 
1 7 51 129 
1 7 73 107 
1 9 51 127 
1 9 85 93 
1 15 45 127 
1 15 65 107 
1 15 73 99 
1 17 17 153 
1 17 51 119 
1 17 63 107 
1 17 85 85 
1 21 73 93 
1 27 31 129 
1 27 33 127 
1 31 63 93 
1 51 51 85 
1 51 63 73 
3 3 17 165 
3 3 63 119 
3 5 15 165 
3 5 27 153 
3 5 51 129 
3 5 73 107 
3 7 51 127 
3 7 85 93 
3 15 17 153 
3 15 51 119 
3 15 63 107 
3 15 85 85 
3 21 45 119 
3 21 65 99 
3 27 31 127 
3 27 51 107 
3 27 65 93 
3 27 73 85 
3 33 33 119 
3 33 45 107 
5 5 51 127 
5 5 85 93 
5 9 9 165 
5 9 21 153 
5 9 45 129 
5 15 15 153 
5 17 73 93 
5 21 33 129 
5 21 63 99 
5 27 27 129 
5 27 63 93 
5 31 33 119 
5 31 45 107 
5 33 51 99 
5 33 65 85 
5 45 45 93 
5 45 65 73 
7 7 9 165 
7 7 21 153 
7 7 45 129 
7 9 45 127 
7 9 65 107 
7 9 73 99 
7 15 73 93 
7 17 45 119 
7 17 65 99 
7 21 31 129 
7 21 33 127 
7 27 27 127 
7 31 31 119 
7 31 51 99 
7 31 65 85 
7 33 63 85 
7 45 51 85 
7 45 63 73 
7 51 65 65 
9 9 17 153 
9 9 51 119 
9 9 63 107 
9 9 85 85 
9 15 45 119 
9 15 65 99 
9 17 33 129 
9 17 63 99 
9 21 31 127 
9 21 51 107 
9 21 65 93 
9 21 73 85 
9 27 33 119 
9 27 45 107 
9 31 63 85 
9 33 73 73 
9 51 63 65 
15 15 31 127 
15 15 51 107 
15 15 65 93 
15 15 73 85 
15 17 27 129 
15 17 63 93 
15 21 33 119 
15 21 45 107 
15 27 27 119 
15 27 73 73 
15 33 33 107 
15 45 63 65 
17 17 27 127 
17 21 21 129 
17 21 31 119 
17 21 51 99 
17 21 65 85 
17 27 45 99 
17 27 51 93 
17 31 33 107 
17 33 45 93 
17 33 65 73 
17 45 63 63 
21 21 27 119 
21 21 73 73 
21 27 33 107 
21 31 51 85 
21 31 63 73 
21 51 51 65 
27 27 27 107 
27 31 31 99 
27 31 45 85 
27 31 65 65 
27 33 63 65 
27 45 51 65 
31 31 33 93 
31 31 63 63 
31 33 51 73 
33 45 45 65 

Noteworthy is a set of all 27's with four scattered 107's.

DefDbl A-Z
Dim crlf$, bpal(100)


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 For i = 1 To 188
   bi$ = base$(i, 2)
   If isPal(bi) Then
     bpPtr = bpPtr + 1
     bpal(bpPtr) = i
   End If
 Next
 Text1.Text = Text1.Text & bpPtr & crlf & crlf
 
 For a = 1 To bpPtr
   tot = bpal(a)
 For b = a To bpPtr
   tot = tot + bpal(b)
 For c = b To bpPtr
   tot = tot + bpal(c)
 For d = c To bpPtr
   DoEvents
   tot = tot + bpal(d)
     If tot = 188 Then
       Text1.Text = Text1.Text & bpal(a) & " "
       Text1.Text = Text1.Text & bpal(b) & " "
       Text1.Text = Text1.Text & bpal(c) & " "
       Text1.Text = Text1.Text & bpal(d) & " "
       Text1.Text = Text1.Text & crlf
       ct = ct + 1
     End If
   tot = tot - bpal(d)
 Next
   tot = tot - bpal(c)
 Next
   tot = tot - bpal(b)
 Next
 Next
 Text1.Text = Text1.Text & crlf & ct & " done"
  
End Sub

Function base$(n, b)
  v$ = ""
  n2 = n
  Do
    d = n2 Mod b
    n2 = n2 \ b
    v$ = LTrim(Str(d)) + v$
  Loop Until n2 = 0
  base$ = v$
End Function

Function isPal(s$)
 good = 1

 For i = 1 To Len(s$) / 2
   If Mid$(s$, i, 1) <> Mid$(s$, Len(s$) + 1 - i, 1) Then good = 0: Exit For
 Next
 isPal = good
End Function


  Posted by Charlie on 2015-12-25 08:11:02
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 (11)
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