# easy and uneasy riddles

Want to share your content on R-bloggers? click here if you have a blog, or here if you don’t.

On 15 January, The Riddler had both a straightforward and a challenging riddles. The first one was to optimise the choice of a real number d with the utility function U(d,θ)=d ℑ(θ>d), when θ is Uniform(0,100). Leading unsurprisingly to d=50…

The tough(er) one was to solve a form of sudoku where the 24 entries of a 8×3 table are integers in {1,…,9} and the information is provided by the row-wise and column-wise products of these integers. The vertical margins are

294, 216, 135, 98, 112, 84, 245, 40

and the horizontal margins are

8 890 560, 156 800, 55 566

After an unsuccessful brute-force (and pseudo-annealed) attempt achieving a minimum error of 127, although using the prime factor decompositions of these 11 margins, I realised that some entries were known: e.g., 7 at (1,2), 5 at (3,2), and 7 at (7,3), and (much later) that the (huge) product value for the first column implied that each term in that column had to be the maximal possible value for the corresponding rows, except for 5 on row 7. This leads to the starting grid

 [,1] [,2] [,3]
[1,] 7 7 6
[2,] 9 0 0
[3,] 9 5 3
[4,] 7 0 0
[5,] 8 0 0
[6,] 7 0 0
[7,] 5 7 7
[8,] 8 0 0


and an additional and obvious exclusion based on the absence of 3’s in the second column, of 5’s and 2’s in the third column shows there was a unique solution

 [,1] [,2] [,3]
[1,] 7 7 6
[2,] 9 8 3
[3,] 9 5 3
[4,] 7 2 7
[5,] 8 2 7
[6,] 7 4 3
[7,] 5 7 7
[8,] 8 5 1


as also demonstrated by a complete exploration with R:

Try it online!

Categories R Tags Excerpt