# Self-referential Sudoku

I built this a while back but never had a good forum for it; this seems like the perfect spot to turn it loose. This is a 'traditional' Sudoku; cells are filled with numbers from 1 through 9, and all usual Sudoku rules apply.

As far as I know (unless I've made a transcription error) this should be rigorously solvable without any guesswork. Enjoy!

• This looks brutal o_o I'm impressed! – Kevin Apr 15 '15 at 23:11
• @Kevin Thank you! In retrospect I wish I'd moved a couple of cell-equations out of the central box to balance things better, but overall I'm immensely pleased with how this one came out. – Steven Stadnicki Apr 15 '15 at 23:17
• I'm pretty sure "Di" isn't an element symbol. (..and then I realised you were using grid identifiers, not the periodic table.) – Ian MacDonald Apr 15 '15 at 23:43
• This looks great, I started it on paper and quickly realized, no, this size paper won't work. – Raystafarian Apr 16 '15 at 13:29

## 1 Answer

I got:

342|975|168
765|821|934
891|364|527
---+---+---
926|538|741
187|496|352
534|217|689
---+---+---
479|652|813
253|189|476
618|743|295

The steps I took to get there were:

De can't be one because it is the sum of two numbers.
De can't be two because then Fd and Hd would both be one, but they are in the same column.
De must be at least 3.
De >= 3 and De * Fd <= 9, so Fd <= 3.
If Fd = 3, then De = 3, but they are in the same box. So Fd <= 2.
If Fd = 1, then Ef = De. But they are in the same box. So Fd = 2.

------------------------------------------------

Ef = De * 2.
De = 2 + Hd.
Ef = (2+Hd) * 2.
Ef = 4 + 2*Hd.
If Ef <= 9, Hd <= 2.
Hd can't be 2 because Fd is 2. So Hd = 1.

De = 3.
Ef = 6.

------------------------------------------------

Hd is 1, so neither Gf nor Hg may be 1.
Gf * Hg <= 9, so they are either (2,2) or (2,3) or (2,4) or (3,3), So Fh is 4 or 6 or 8 or 9.
He = 1 = Ee - Fh, so Ee = Fh + 1. So Ee is 5 or 7 or 9 or 10.

Ee = Cd * Hc.
Both Cd and Hc are in line with Hd, so Ee can't be 5 or 7.
So Ee = 9 and Fh = 8.

Gf and Hg are (2,4), but we don't yet know which is which.
Dc is 6.

------------------------------------------------

Ee is 9, so Cd and Hc are both 3. (They can't be 1 and 9 because they're both in line with Hd, which is 1)
Dd - Gf = 3.
Gf is either 2 or 4, so Dd is either 5 or 7.
Ha = Ff - Dd, and Ha != 1 because it is in line with Hd.
If Dd is 7, then either Ha is 1 or Ff is 9, but both are contradictions. So Dd must be 5.

Gf = 2.
Hg = 4.

------------------------------------------------
Ha = Ff - Dd = Ff - 5, So Ff > 5.
Ff is lin line with 6, 8, and 9, so Ff = 7.
Ha = 2.

------------------------------------------------

Da = Bf + Fh = Bf + 8.
So Da = 9 and Bf = 1.
Fe = 1 because it's the only remaining cell in the center box that could be 1.

------------------------------------------------
Bi = Fh - Ed = 8 - Ed, so Ed < 8.
Ed can only be 8 or 4.
So Ed = 4, and Bi = 4.

De = 4 = Be * Ch. Be can't be 1 or 4.
So Be = 2 and Ch = 2.

------------------------------------------------
Df is 8, because it's the last cell in the center box.
If is 3, because it's the only cell in the box that can be 3.
Ei = If - Gh = 3 - Gh, so Gh <= 2.
Gh is in line with 2, so Gh = 1 and Ei = 2.

------------------------------------------------
Ig = 2.
Db = 2.
Ac = 2.
Dh = 4.
------------------------------------------------
Ba = He - Di, so He > Di.
He can be (5,6,7,8). Di can be 1 or 7.
If Di is 7, He is 8 and Ba is 1. But Ba can't be 1. So Di = 1.
Dg = 7.

------------------------------------------------
Ih = Bh + Hi, and Hi >= 5, So Bh <= 4.
Bh can't be 1,2, or 4, so Bh = 3.
Ih <= 9, so Hi is 5 or 6.
If Hi is 5, Ih is 8, but Fh is 8. So Hi = 6 and Ih = 9.
------------------------------------------------
Fg = 6.
Ah = 6.
Fi = 9.
Eg = 3.
Gi = 3.
Eh = 5.
Hh = 7.
------------------------------------------------
Ba = He - 1. He can be 5 or 8, so Ba can be 4 or 7. But Ba can't be 4, so Ba = 7 and He = 5.
------------------------------------------------
Ea and Ec can only be (1,7,8). So Id = Ea * Ec is 7 or 8.
He is 8, so Id can't be 8, so Id is 7.
Ea can't be 7, so Ea is 1 and Ec is 7.
Eb = 8.
------------------------------------------------
Fc is 4 or 5. Ga is 4, 5, or 6. Bd = Fc + Ga, so Bd can't be 6. So Gd is the only cell in the column that can be 6.
Hf = 9.
Hb = 5.
Bd <= 9, so Ga can't be 6. Hb is 5, so Ga can't be 5. So Ga = 4.
Ie = 4.
Ge = 5.
Ii = 5.
Gg = 8.
Gb = 7.
Gc = 9.
Ce = 6.
Ae = 7.
Ci = 7.
Ai = 8.
Bd = 8.
Bd = Fc + Ga, so 8 = Fc + 4, So Fc = 4.
Fa = 5.
Fb = 3.
Ad = 9.
Bc = 5.
Ca = 8.
Aa = 3.
Ia = 6.
Ic = 8.
Ib = 1.
Cc = 1.
Ag = 1.
Ab = 4.
Bb = 6.
Cb = 9.
Af = 5.
Cf = 4.
Cg = 5.
Bg = 9.

• This tracks pretty close to my own solution - nicely done! I'll give folks another day or so to poke around before accepting... – Steven Stadnicki Apr 16 '15 at 18:14
• Well done! I solved this using the UglyPileOfCode™ method and can confirm that yours is the only correct solution. – squeamish ossifrage Apr 16 '15 at 18:59
• @squeamishossifrage, nice :-) I considered writing some ugly code as well, but I couldn't think of a nice way to get the complexity down. Sudoku solvers tend to take factorial time if you don't approach them right. – Kevin Apr 17 '15 at 11:37
• This is the same answer I got. My method is secret :D (less than one second to solve) – d'alar'cop Apr 17 '15 at 19:37