Euler has design of a homepage and there is a link back to the overview for each solution.

This commit is contained in:
2018-06-14 20:11:26 -04:00
parent 894160d1a0
commit c34ebd6181
48 changed files with 1134 additions and 2394 deletions

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<head><meta charset="utf-8"/>
<title>EulerProblem028</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
*
@@ -11714,8 +11714,6 @@ ul.typeahead-list > li > a {
.ansi-bold { font-weight: bold; }
</style>
<style type="text/css">
/* Overrides of notebook CSS for static HTML export */
body {
@@ -11741,15 +11739,13 @@ div#notebook {
}
}
</style>
<!-- Custom stylesheet, it must be in the same directory as the html file -->
<link rel="stylesheet" href="custom.css">
<link href="custom.css" rel="stylesheet"/>
<!-- Loading mathjax macro -->
<!-- Load mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML"></script>
<!-- MathJax configuration -->
<script type="text/x-mathjax-config">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML"></script>
<!-- MathJax configuration -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
@@ -11766,17 +11762,15 @@ div#notebook {
}
});
</script>
<!-- End of mathjax configuration --></head>
<!-- End of mathjax configuration --></head>
<body>
<div tabindex="-1" id="notebook" class="border-box-sizing">
<div class="container" id="notebook-container">
<div class="border-box-sizing" id="notebook" tabindex="-1">
<div class="container" id="notebook-container">
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Euler-Problem-28">Euler Problem 28<a class="anchor-link" href="#Euler-Problem-28">&#182;</a></h1><p>Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:</p>
<h1 id="Euler-Problem-28">Euler Problem 28<a class="anchor-link" href="#Euler-Problem-28"></a></h1><p><a href="/euler">Back to overview.</a></p><p>Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:</p>
<pre><code>21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
@@ -11785,7 +11779,6 @@ div#notebook {
<p>$1 + 3 + 5 + 7 + 9 + 13 + 17 + 21 + 25 = 101$</p>
<p>It can be verified that the sum of the numbers on the diagonals is 101.</p>
<p>What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?</p>
</div>
</div>
</div>
@@ -11794,15 +11787,14 @@ div#notebook {
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>When we know the corner of a certain spiral we can calculate it's total like $f_n = 4 c_n + 6 (n - 1)$. We then only have to update the corner value for each spiral.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[1]:</div>
<div class="prompt input_prompt">In [1]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">total</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">current_corner</span> <span class="o">=</span> <span class="mi">3</span>
@@ -11812,45 +11804,31 @@ div#notebook {
<span class="n">s</span> <span class="o">=</span> <span class="n">total</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[2]:</div>
<div class="prompt input_prompt">In [2]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">assert</span><span class="p">(</span><span class="n">s</span> <span class="o">==</span> <span class="mi">669171001</span><span class="p">)</span>
<span class="n">s</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[2]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>669171001</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
@@ -11862,50 +11840,33 @@ div#notebook {
<p>$c_n = (n - 1)^2 - (n - 2) = n^2 - 2n + 1 - n + 2 = n^2 - 3n + 3$.</p>
<p>Now, we can insert $c_n$ into $f_n$ which gives as the sum of corners for the nth spiral:</p>
<p>$f_n = 4n^2 - 12n + 12 + 6n - 6 = 4n^2 - 6n + 6$</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[3]:</div>
<div class="prompt input_prompt">In [3]:</div>
<div class="inner_cell">
<div class="input_area">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">s</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="nb">sum</span><span class="p">([</span><span class="mi">4</span> <span class="o">*</span> <span class="n">n</span> <span class="o">*</span> <span class="n">n</span> <span class="o">-</span> <span class="mi">6</span> <span class="o">*</span> <span class="n">n</span> <span class="o">+</span> <span class="mi">6</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1002</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span>
<span class="k">assert</span><span class="p">(</span><span class="n">s</span> <span class="o">==</span> <span class="mi">669171001</span><span class="p">)</span>
<span class="n">s</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[3]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>669171001</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>