Ulam Spiral by Denis
Loading the math board and drawing, please wait…
This example demonstrates the Ulam spiral pattern. Core mathematical concepts include prime number distribution and geometric construction. Key points for drawing: Uses GeoGebra commands Join, Min, Sequence, Polygon, Length, Zip, RemoveUndefined; objects include n, center, stepX, stepY, nn, listX, listY, scale, numsShow, factsShow, sprShow, A, B, C, back, D, mm, lp, prmsShow, text1, circles, spiral, pntShow, primes, numbers, cx, cy, prmsPoints, numsPoints. Suitable for high school and above mathematics enthusiasts and researchers.
GeoGebra Commands & Parameters
Join({{0, 1}, Join[Sequence[Join[{Sequence[0, j, 1, m], Sequence[(-1)^(m), j, 1, m + 1]}], m, 1, n]]}) → stepXJoin({{0, 0}, Join[Sequence[Join[{Sequence[(-1)^(m + 1), j, 1, m], Sequence[0, j, 1, m + 1]}], m, 1, n]]}) → stepYMin(Length[stepX], Length[stepY]) → nnSequence(Sum[stepX, m], m, 1, nn) → listXSequence(Sum[stepY, m], m, 1, nn) → listYPolygon((-1.2, -1.2), (1.2, -1.2), 4) → backLength(PrimeFactors[mm]) → lpZip(Circle[(2 * cx / n, 2 * cy / n), LP[center + k] / scale / n], cx, listX, cy, listY, k, Sequence[nn - 1]) → circlesSequence(mySegm[2 * (Element[listX, k], Element[listY, k]) / n, 2 * (Element[listX, k + 1], Element[listY, k + 1]) / n], k, 1, nn - 2) → spiralRemoveUndefined(Zip[If[LP[center + k] ≟ 1, Text[center + k, (2 * (cx - 0.15) / n, 2 * (cy - 0.05) / n)]], cx, listX, cy, listY, k, Sequence[nn - 1]]) → primesRemoveUndefined(Zip[Text[center + k, (2 * (cx - 0.15) / n, 2 * (cy - 0.05) / n)], cx, listX, cy, listY, k, Sequence[nn - 1]]) → numbersRemoveUndefined(Zip[If[LP[center + k] ≟ 1, 2 * (cx, cy) / n], cx, listX, cy, listY, k, Sequence[nn - 1]]) → prmsPointsZip(2 * (cx, cy) / n, cx, listX, cy, listY, k, Sequence[nn - 1]) → numsPoints