From 334c179b9ca0ba08d9dd3298cbcd9a06257be42e Mon Sep 17 00:00:00 2001 From: P Wilson <92426837+PWilson-1978@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:15:36 -0500 Subject: [PATCH] ulam hexagon spiral variant in python I have a 3 radii hexagon and all of the primes line up on the radii associated with 5 and 7. I have another version that opens a file of primes up to 5000 if the square root of a number is larger, it will fill in the primes between. I modified the routine that checks for the prime and added a check for the last digit of 5 in the check with division of 2 because any number that has a 5 will be divisible by 5, and then I'm also testing another qualification if the modulo of the value being checked is 1 or 5, it may be a prime. Both print out the lists of prime values at the conclusion of the run. --- _CodingChallenges/167-prime-spiral.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/_CodingChallenges/167-prime-spiral.md b/_CodingChallenges/167-prime-spiral.md index 563e6c8c68..00586c24f3 100644 --- a/_CodingChallenges/167-prime-spiral.md +++ b/_CodingChallenges/167-prime-spiral.md @@ -122,6 +122,14 @@ contributions: url: "https://github.com/dipamsen/" url: "https://editor.p5js.org/funplanet/full/sHq2rfZuv" source: "https://editor.p5js.org/funplanet/sketches/sHq2rfZuv" ---- + - title: "Ulam hexagon spiral variant in python" + author: + name: "Paula Wilson" + url: "https://github.com/PWilson-1978" + url: "https://github.com/PWilson-1978/ulam-hex-spiral" + source: "7thwHM0Yj_U" + + + Why do prime numbers show up as diagonals in a spiral? In this video, I create a visualization in JavaScript (p5.js) of the Ulam Spiral (aka Prime Spiral) named for Polish Mathematician Stanislav Ulan.