JupiteX Get the app
Science & Technology30 Nov 2026 · about 7 min

An O(N) implicit representation for the Koch Snowflake

The brief

The Koch snowflake is a fractal shape made by repeatedly adding triangular bumps along its edges. In the standard construction, each straight edge is divided into three equal segments, the middle segment is replaced by two sides of an outward-pointing triangle, and the process is repeated on every resulting edge. This makes the boundary increasingly detailed at each level. The article approaches the shape through an implicit representation: a function takes a position (x, y) and returns a signed value indicating whether that point is inside or outside. Rather than recursively drawing every segment, the author looks for a compact formula. The article also describes replacing pairs of small triangles with larger ones to avoid zero-area cracks between neighboring pieces. The article’s stated goal is a closed-form function whose complexity grows linearly with the number of levels, rather than exponentially. The excerpt introduces hexification and modulo-based repetition as tools toward that goal, but ends before showing the complete final snowflake formula. The repeated-bump description is standard background; it is not spelled out step by step in the excerpt.

01

What is the Koch snowflake, and how is it built by repeatedly adding triangular bumps to a shape’s edges?

The Koch snowflake is a fractal shape made by repeatedly adding triangular bumps along its edges. In the standard construction, each straight edge is divided into three equal segments, the middle segment is replaced by two sides of an outward-pointing triangle, and the process is repeated on every resulting edge. This makes the boundary increasingly detailed at each level.

The article approaches the shape through an implicit representation: a function takes a position (x, y) and returns a signed value indicating whether that point is inside or outside. Rather than recursively drawing every segment, the author looks for a compact formula. The article also describes replacing pairs of small triangles with larger ones to avoid zero-area cracks between neighboring pieces.

The article’s stated goal is a closed-form function whose complexity grows linearly with the number of levels, rather than exponentially. The excerpt introduces hexification and modulo-based repetition as tools toward that goal, but ends before showing the complete final snowflake formula. The repeated-bump description is standard background; it is not spelled out step by step in the excerpt.

02

In an implicit representation, what value does the function return for a point inside or outside the snowflake?

An implicit representation describes a shape by a function, rather than by explicitly listing all its boundary pieces. For the snowflake, the function accepts a position (x, y) and returns a signed value. The sign is the key information: it identifies whether the point is inside or outside the shape.

The article sets the convention directly: negative values mean inside the snowflake, while positive values mean outside. The boundary is where the value is zero, as the article’s discussion of distance fields and isosurfaces indicates. That makes it possible to evaluate the shape at positions without first building a separate list of every little triangle.

This sign-based rule is the target for the proposed closed-form function. The article says the function should use arithmetic operations such as addition, modulo, minimum, and maximum, with no recursion, looping, or reliance on short-circuiting conditionals. The excerpt does not give the completed final function, but it clearly states what its output must mean.

03

How does the method’s complexity grow with the number of levels, compared with the recursive method’s O(4^N) growth?

The article sets the number of snowflake levels, N, as the measure of complexity. Its target is a function with O(N) complexity: each added level should increase the work only linearly. This matters because a direct recursive construction calls itself four times to divide each segment into four, causing exponential growth.

The recursive baseline is described as O(4^N), which the author calls “Very Bad.” The article also shows that a hexify transform copies its input six times, so repeatedly applying that transform alone still multiplies the element count by six per call. The author’s challenge is to avoid that kind of growing list of explicit pieces.

The excerpt presents domain repetition as a way to move toward linear complexity, and its title calls the representation O(N). However, the supplied text ends during the repetition discussion and does not show the finished expression or a proof. The comparison is clear: the goal is linear growth instead of the recursive method’s exponential growth.

04

What does reducing the representation’s complexity to O(N) make possible when creating deeper snowflakes?

A snowflake gains detail with every level, so the way complexity grows determines how costly deeper versions are to represent. The article contrasts a desired O(N) formula with a recursive construction that grows as O(4^N). Linear growth means each added level raises complexity by a steady amount rather than multiplying the work exponentially.

The concrete warning is that even the article’s hexify transform copies its input six times. Repeating such a transform would multiply the element count at each call. The proposed alternative uses domain repetition: a repeating pattern can stand in for many separate copies, using operations such as modulo instead of explicitly constructing every piece.

If the O(N) target is achieved, deeper levels would require a much smaller increase in representation complexity than the recursive baseline. That is why the approach could make higher-detail snowflakes more practical to create. The provided excerpt does not give benchmark results, a maximum level, or a finished implementation, so it establishes the intended benefit rather than measured performance.

05

How does modulo-based domain repetition create a repeating triangle pattern without explicitly building every copy?

Domain repetition lets an implicit formula describe a repeating arrangement without listing each copy as a separate element. The article points out that modulo is useful for making infinite repetitions in implicit surfaces. This matters because repeated copies can otherwise cause the element count to grow rapidly as the fractal gains levels.

For its example, the author builds a repeating horizontal bar cutout with a modulo expression involving y. The expression is then combined with rotated versions at 120 and 240 degrees. Together, these bars create triangle patterns. The article explains that level-two triangles are part of an infinitely repeating pattern of larger tiles.

Instead of explicitly placing every tile, the formula maps positions into a repeating pattern using modulo. This is presented as good news for reducing the cost of the representation. The excerpt does not include the rest of the derivation, so it does not show how the repeated pattern is ultimately restricted to produce the complete snowflake. It does establish the core mechanism: repetition encoded through an arithmetic expression.

06

Why does an infinite repeating pattern contain stray triangles, and how do safe zones help keep only the central snowflake?

The excerpt introduces an infinite repeating pattern as a useful step: it says that the light-blue level-two triangles in the snowflake are a subset of darker-blue tiles that repeat indefinitely. It also says modulo can construct infinite repetitions in implicit surfaces. These details establish that the pattern extends beyond the intended snowflake.

However, the supplied text stops immediately after beginning to explain that the triangles are in the negative region of the cutout. It does not describe stray triangles, explain why they appear, or introduce safe zones. There is therefore no source-grounded account of how a safe-zone restriction would work or which areas it would keep.

The broader idea is that a repeating pattern covers more space than a finite snowflake, so some way to distinguish the desired portion could be needed. That observation follows from the stated subset relationship, but the excerpt supplies no specific safe-zone method. The article text provided here cannot answer the question’s details without information beyond the excerpt.

07

What is common subexpression elimination, and why does reusing a calculated expression matter in an implicit formula?

Common subexpression elimination is a way to avoid repeating the same calculation: if a formula needs an identical intermediate expression more than once, it can calculate that expression once and reuse the result. The article explicitly assumes this behavior when defining the rules for its implicit function.

That assumption matters because the function is built from arithmetic operations and can reuse earlier results. For example, the article’s modulo-based cutout expression is combined with rotated copies. Under the stated assumption, any shared subexpression only needs to be computed once, rather than counted as a fresh computation wherever it appears. The author describes reuse as free elsewhere in the function.

This is part of the design requirements for the Fidget implicit kernel, alongside the ban on recursion, loops, and reliance on short-circuiting conditionals. Reuse does not by itself prove that the snowflake formula has O(N) complexity, but it affects how the formula’s work is counted. The excerpt sets it as an assumption for evaluating the proposed representation.

This brief was written by AI from the original reporting and checked by other models. Names, figures and quotes come from the source; read it for full context.

Read more in the JupiteX app

Pulse is free. New stories every 4 hours, each one broken into the questions that explain it.

Or read more news on the web