Ulam spiral (for primes): Difference between revisions

align grids horizontally
(→‎{{header|Java}}: added larger scale Ulam spiral)
(align grids horizontally)
Line 19:
Sometimes, the starting number can be specified to show more visual striking patterns (of prime densities).
 
[A larger than necessary grid (numbers wise) is shown here to illustrate the pattern of numbers on the diagonals   (which may be used by the method to orientate the direction of spiral-construction algorithm within the example computer programs)].
{| class="wikitable" style="float:center;border: 4px solid blue; background:lightgreen; color:black; margin-left:auto;margin-right:auto;text-align:center;width:34em;height:34em;table-layout:fixed;font-size:125%"
 
Then, in the next phase in the transformation of the Ulam prime spiral,   the non-primes are translated to blanks.
 
In the orange grid below,   the primes are left intact,   and all non-primes are changed to blanks.
 
Then, in the final transformation of the Ulam spiral (the yellow grid), &nbsp; translate the primes to a glyph such as a &nbsp; <big><big><b> ∙ </b></big></big> &nbsp; or some other suitable glyph.
<br>
 
{| class="wikitable" style="float:centerleft;border: 4px2px solid blueblack; background:lightgreen; color:black; margin-left:auto0;margin-right:auto;text-align:center;width:34em;height:34em;table-layout:fixed;font-size:12570%"
|-
| <big><big>'''65'''</big></big> || <big><big>'''64'''</big></big> || <big><big>'''63'''</big></big> || <big><big>'''62'''</big></big> || <big><big>'''61'''</big></big> || <big><big>'''60'''</big></big> || <big><big>'''59'''</big></big> || <big><big>'''58'''</big></big> || <big><big>'''57'''</big></big>
Line 40 ⟶ 49:
|}
 
{| class="wikitable" style="float:centerleft;border: 4px2px solid blueblack; background:orange; color:black; margin-left:auto20px;margin-right:auto;text-align:center;width:34em;height:34em;table-layout:fixed;font-size:12570%"
[A larger than necessary grid (numbers wise) is shown here to illustrate the pattern of numbers on the diagonals &nbsp; (which may be used by the method to orientate the direction of spiral-construction algorithm within the example computer programs)].
 
 
Then, in the next phase in the transformation of the Ulam prime spiral, &nbsp; the non-primes are translated to blanks.
 
In the orange grid below, &nbsp; the primes are left intact, &nbsp; and all non-primes are changed to blanks.
 
{| class="wikitable" style="float:center;border: 4px solid blue; background:orange; color:black; margin-left:auto;margin-right:auto;text-align:center;width:34em;height:34em;table-layout:fixed;font-size:125%"
|-
| <big><big>''' '''</big></big> || <big><big>''' '''</big></big> || <big><big>''' '''</big></big> || <big><big>''' '''</big></big> || <big><big>'''61'''</big></big> || <big><big>''' '''</big></big> || <big><big>'''59'''</big></big> || <big><big>''' '''</big></big> || <big><big>''' '''</big></big>
Line 68 ⟶ 70:
|}
 
{| class="wikitable" style="float:centerleft;border: 4px2px solid blueblack; background:yellow; color:black; margin-left:auto20px;margin-right:auto;text-align:center;width:34em;height:34em;table-layout:fixed;font-size:12570%"
Then, in the final transformation of the Ulam spiral (the yellow grid), &nbsp; translate the primes to a glyph such as a &nbsp; <big><big><b> ∙ </b></big></big> &nbsp; or some other suitable glyph.
 
{| class="wikitable" style="float:center;border: 4px solid blue; background:yellow; color:black; margin-left:auto;margin-right:auto;text-align:center;width:34em;height:34em;table-layout:fixed;font-size:125%"
|-
| <big><big>''' '''</big></big> || <big><big>''' '''</big></big> || <big><big>''' '''</big></big> || <big><big>''' '''</big></big> || <big><big>''' ∙'''</big></big> || <big><big>''' '''</big></big> || <big><big>''' ∙'''</big></big> || <big><big>''' '''</big></big> || <big><big>''' '''</big></big>
Line 91:
|}
 
 
<br style="clear:both">
The Ulam spiral becomes more visually obvious as the grid increases in size.
 
Line 101 ⟶ 103:
 
;Also see:
::* Wikipedia entry: [http://en.wikipedia.org/wiki/Ulam_spiral Ulam spiral].
::* MathWorld&trade; entry: [http://mathworld.wolfram.com/PrimeSpiral.html Prime Spiral].
<br><br>
 
Anonymous user