<html><head></head><body><div class="ydpb5135331yahoo-style-wrap" style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 13px;"><div></div>
<div dir="ltr" data-setdir="false">Update: Doug showed me a fast algorithm that does the trick. It doesn't use recursion. For an nxn board, the algorithm counts the possibilities given a knight in each of these regions:</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">1. The central (n-4)x(n-4) sub-board</div><div dir="ltr" data-setdir="false">2. The squares bordering this central sub-board but excluding the four "corners" where the row and column squares intersect</div><div dir="ltr" data-setdir="false">3. The edge squares adjacent to the ones in #2</div><div dir="ltr" data-setdir="false">4. The four "corners" excluded in #2 that are one square diagonal from each of the four corners of the nxn board</div><div dir="ltr" data-setdir="false">5. The eight edge squares adjacent to the four corners of the nxn board</div><div dir="ltr" data-setdir="false">6. The four corners of the nxn board</div><div><br></div><div dir="ltr" data-setdir="false">Sum these and divide by two (because the two knights are interchangeable) and you can calculate the solution very quickly for any nxn. Mapping this over [1..n] will provide the required output. My takeaway from this is that using the solution to case n-1 in order to solve case n may not be the most efficient way to do things. Sometimes just solving for case n from scratch is faster.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thanks Doug.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Julian</div><div><br></div>
</div><div id="ydpabe605b9yahoo_quoted_4254608931" class="ydpabe605b9yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Sunday, June 28, 2020, 09:00:53 AM PDT, Julian Ong <julian_ong@yahoo.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">There are 8 possibilities and then you can filter them by column and row values depending on the region of the board you’re interested in.<br clear="none"><br clear="none">Julian<br clear="none"><div class="ydpabe605b9yqt4796570920" id="ydpabe605b9yqtfd36283"><br clear="none">On Jun 28, 2020, at 8:26 AM, Doug McIlroy <<a shape="rect" href="mailto:doug@cs.dartmouth.edu" rel="nofollow" target="_blank">doug@cs.dartmouth.edu</a>> wrote:<br clear="none"><br clear="none"><br clear="none">> I'm currently stuck on the Two Knights problem.<br clear="none"><br clear="none">Having placed one knight on the board, in how many<br clear="none">places can you put the other?<br clear="none"><br clear="none">Doug McIlroy<br clear="none"></div></div></div>
</div>
</div></body></html>