<html><head></head><body><div class="ydpbaedf408yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div dir="ltr" data-setdir="false">I realized I did not answer the question Doug posed, but the algorithm as originally presented works correctly and calculates correctly the number of possible knight pairings for each k x k board and generates the correct output requested by the problem.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">The issue is still that, as I have implemented it in Haskell, it doesn't run fast enough to pass the automated CSES testing for n=10000. I am very curious whether it's possible to pass the speed testing for this problem using Haskell and if so how.</div><div><br></div>
        
        </div><div id="ydp6b38afayahoo_quoted_4139222292" class="ydp6b38afayahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Sunday, June 28, 2020, 09:49:02 AM PDT, Irfon-Kim Ahmad <irfon@ambienautica.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydp6b38afayiv2108629601"><div>
    <div class="ydp6b38afayiv2108629601moz-cite-prefix">On 2020-06-28 11:26 a.m., Doug McIlroy
      wrote:<br clear="none">
    </div>
    <blockquote type="cite">
      <pre class="ydp6b38afayiv2108629601moz-quote-pre"></pre>
      <blockquote type="cite">
        <pre class="ydp6b38afayiv2108629601moz-quote-pre">I'm currently stuck on the Two Knights problem.
</pre>
      </blockquote>
      <pre class="ydp6b38afayiv2108629601moz-quote-pre">Having placed one knight on the board, in how many
places can you put the other?
</pre>
    </blockquote>
    <p>If you check the website indicated, it's a slight variation on
      that: <br clear="none">
    </p>
    <p>"Your task is to count for <span class="ydp6b38afayiv2108629601MathJax_Preview" style="color:inherit;"></span><span class="ydp6b38afayiv2108629601MathJax" id="ydp6b38afayiv2108629601MathJax-Element-1-Frame" style="position:relative;"><span class="ydp6b38afayiv2108629601math" id="ydp6b38afayiv2108629601MathJax-Span-1" style="width:7.016em;display:inline-block;"><span style="display:inline-block;position:relative;width:6.14em;min-height:0px;font-size:114%;"><span><span class="ydp6b38afayiv2108629601mrow" id="ydp6b38afayiv2108629601MathJax-Span-2"><span class="ydp6b38afayiv2108629601mi" id="ydp6b38afayiv2108629601MathJax-Span-3" style="font-style:italic;">k</span><span class="ydp6b38afayiv2108629601mo" id="ydp6b38afayiv2108629601MathJax-Span-4" style="padding-left:0.278em;">=</span><span class="ydp6b38afayiv2108629601mn" id="ydp6b38afayiv2108629601MathJax-Span-5" style="padding-left:0.278em;">1</span><span class="ydp6b38afayiv2108629601mo" id="ydp6b38afayiv2108629601MathJax-Span-6">,</span><span class="ydp6b38afayiv2108629601mn" id="ydp6b38afayiv2108629601MathJax-Span-7" style="padding-left:0.167em;">2</span><span class="ydp6b38afayiv2108629601mo" id="ydp6b38afayiv2108629601MathJax-Span-8">,</span><span class="ydp6b38afayiv2108629601mo" id="ydp6b38afayiv2108629601MathJax-Span-9" style="padding-left:0.167em;">…</span><span class="ydp6b38afayiv2108629601mo" id="ydp6b38afayiv2108629601MathJax-Span-10" style="padding-left:0.167em;">,</span><span class="ydp6b38afayiv2108629601mi" id="ydp6b38afayiv2108629601MathJax-Span-11" style="font-style:italic;padding-left:0.167em;">n</span></span><span style="display:inline-block;width:0px;min-height:2.193em;"></span></span></span><span style="display: inline-block; vertical-align: -0.284em; border-left: 0px solid; width: 0px; min-height: 1.137em;"></span></span></span> the
      number of ways two knights can be placed on a <span class="ydp6b38afayiv2108629601MathJax_Preview" style="color:inherit;"></span><span class="ydp6b38afayiv2108629601MathJax" id="ydp6b38afayiv2108629601MathJax-Element-2-Frame" style="position:relative;"><span class="ydp6b38afayiv2108629601math" id="ydp6b38afayiv2108629601MathJax-Span-12" style="width:2.578em;display:inline-block;"><span style="display:inline-block;position:relative;width:2.248em;min-height:0px;font-size:114%;"><span><span class="ydp6b38afayiv2108629601mrow" id="ydp6b38afayiv2108629601MathJax-Span-13"><span class="ydp6b38afayiv2108629601mi" id="ydp6b38afayiv2108629601MathJax-Span-14" style="font-style:italic;">k</span><span class="ydp6b38afayiv2108629601mo" id="ydp6b38afayiv2108629601MathJax-Span-15" style="padding-left:0.222em;">×</span><span class="ydp6b38afayiv2108629601mi" id="ydp6b38afayiv2108629601MathJax-Span-16" style="font-style:italic;padding-left:0.222em;">k</span></span><span style="display:inline-block;width:0px;min-height:2.193em;"></span></span></span><span style="display: inline-block; vertical-align: -0.075em; border-left: 0px solid; width: 0px; min-height: 0.929em;"></span></span></span> 
      chessboard so that they do not attack each other."<br clear="none">
    </p>
    <p>The input is n (an integer that can range from 1 to 10000), the
      output is a single integer for each value from 1 to n, one per
      line, the memory limit is 512MB, and the maximum runtime is 1.00
      seconds. </p><div class="ydp6b38afayiv2108629601yqt4596307336" id="ydp6b38afayiv2108629601yqtfd56774"><br clear="none">
    </div><div class="ydp6b38afayiv2108629601yqt4596307336" id="ydp6b38afayiv2108629601yqtfd45770">
    <p><br clear="none">
    </p>
  </div></div></div>_______________________________________________<br clear="none">Beginners mailing list<br clear="none"><a shape="rect" href="mailto:Beginners@haskell.org" rel="nofollow" target="_blank">Beginners@haskell.org</a><br clear="none"><a shape="rect" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="nofollow" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><div class="ydp6b38afayqt4596307336" id="ydp6b38afayqtfd10315"><br clear="none"></div></div>
            </div>
        </div></body></html>