geometor.knott.golden_string

Collection 5: The Golden String, Zeckendorf Base, & Wythoff / Stolarsky Arrays (KNOTT-5.1 – KNOTT-5.3).

Catalogs the Sturmian Golden String (101101011011...), lattice-cutting slope geometry, Zeckendorf’s canonical Fibonacci numeral base, Beatty’s complementary sequences, and Morrison’s Wythoff and Stolarsky interspersion arrays curated by Dr. Ron Knott on fibrab.html, fibrep.html, and fibGen.html.

Functions

golden_string_generations([steps]) → list[str]

Generate finite Rabbit-tree / morphism words \(S_1, S_2, \dots, S_{\text{steps}}\).

golden_string_beatty_word(length) → str

Compute the first length characters of the Golden String via exact floor differences.

recursive_fib_additions(n) → int

Return the exact number of additions in naive recursive fib(n) (with F_1 = F_2 = 1).

construct_golden_string_cutting_model() → geometor.knott.flat_geometry.GeometricCatalogResult

Construct KNOTT-5.1: Sturmian lattice-cutting line \(y = \phi x\) generating 10110101.

zeckendorf_summands(n) → list[int]

Return the unique non-consecutive Fibonacci summands of positive integer n.

to_zeckendorf(n) → str

Encode non-negative integer n into its canonical Zeckendorf Fibonacci-base string.

from_zeckendorf(bit_str) → int

Decode any Fibonacci-base bitstring (with rightmost column \(F_2 = 1\)) into an int.

construct_zeckendorf_staircase_model() → geometor.knott.flat_geometry.GeometricCatalogResult

Construct KNOTT-5.2: Geometric Fibonacci staircase & Zeckendorf decomposition of 12 = 8 + 3 + 1.

beatty_pair(n) → tuple[int, int]

Return Beatty's complementary Golden pair \((\lfloor n\Phi \rfloor, \lfloor n\Phi^2 \rfloor)\) for \(n \ge 1\).

wythoff_entry(row, col) → int

Compute entry W(row, col) (0-indexed) of Morrison's Wythoff Array.

wythoff_locate(n) → tuple[int, int]

Locate the unique (row, col) (0-indexed) of positive integer n in the Wythoff Array.

stolarsky_entry(row, col) → int

Compute entry S(row, col) (0-indexed) of Kenneth Stolarsky's (1977) Array.

construct_wythoff_beatty_model() → geometor.knott.flat_geometry.GeometricCatalogResult

Construct KNOTT-5.3: Wythoff / Beatty slope rays \(y = \Phi x\) & \(y = \Phi^2 x\) and cold positions.

Module Contents

geometor.knott.golden_string.golden_string_generations(steps: int = 7) → list[str]

Generate finite Rabbit-tree / morphism words \(S_1, S_2, \dots, S_{\text{steps}}\).

Applies the Sturmian substitution \(1 \mapsto 10,\; 0 \mapsto 1\) starting from S_1 = '1' (equivalently \(S_k = S_{k-1} + S_{k-2}\) for \(k \ge 3\), with \(|S_k| = F_{k+1}\)).

Parameters:

steps – Number of finite generations to return (\(\ge 1\)).

Returns:

List of finite Golden String prefixes ['1', '10', '101', '10110', ...].

geometor.knott.golden_string.golden_string_beatty_word(length: int) → str

Compute the first length characters of the Golden String via exact floor differences.

Uses \(d_n = \lfloor (n + 1)\phi \rfloor - \lfloor n\phi \rfloor\) for \(n = 1, 2, \dots, \text{length}\), evaluated via pure integer arithmetic floor_linear_phi() (\(n\phi = -n + n\Phi\)).

Parameters:

length – Prefix length (\(\ge 1\)).

Returns:

Exact binary prefix of 101101011011010110101....

geometor.knott.golden_string.recursive_fib_additions(n: int) → int

Return the exact number of additions in naive recursive fib(n) (with F_1 = F_2 = 1).

Cataloged on fibrab.html#props: \(A(1) = A(2) = 0\) and \(A(n) = A(n-1) + A(n-2) + 1 = F_n - 1\) (or \(F_{n+1} - 1\) when 0-indexed base cases fib(0), fib(1) are used). Here for F_1 = F_2 = 1, \(A(n) = F_n - 1\); for 0-based fib(0)=0, fib(1)=1, \(A_0(n) = F_{n+1} - 1\).

Parameters:

n – Non-negative integer index for 0-based fib(n) (\(n \ge 1\)).

Returns:

Exact addition count \(F_{n+1} - 1\).

geometor.knott.golden_string.construct_golden_string_cutting_model() → geometor.knott.flat_geometry.GeometricCatalogResult

Construct KNOTT-5.1: Sturmian lattice-cutting line \(y = \phi x\) generating 10110101.

Constructs ray [O R] of exact slope \(\phi = \Phi - 1\) across vertical grid lines \(x = 1..5\) and horizontal grid lines \(y = 1..3\) in geometor.model. Intersecting [O R] with every grid line in order of distance from O produces vertical crossings V1..V5 (digit 1) and horizontal crossings H1..H3 (digit 0) in exact sequence V1, H1, V2, V3, H2, V4, H3, V5 -> 10110101!

Returns:

Verified GeometricCatalogResult for KNOTT-5.1.

geometor.knott.golden_string.zeckendorf_summands(n: int) → list[int]

Return the unique non-consecutive Fibonacci summands of positive integer n.

Uses Fibonacci place values \(F_2 = 1, F_3 = 2, F_4 = 3, F_5 = 5, \dots\).

Parameters:

n – Positive integer (\(n \ge 1\)).

Returns:

Descending list of non-adjacent Fibonacci numbers summing to n.

geometor.knott.golden_string.to_zeckendorf(n: int) → str

Encode non-negative integer n into its canonical Zeckendorf Fibonacci-base string.

Columns from right to left represent \(F_2=1, F_3=2, F_4=3, F_5=5, F_6=8, \dots\) (e.g., to_zeckendorf(12) == '10101' for \(8 + 3 + 1\)).

Parameters:

n – Non-negative integer.

Returns:

11-free binary Fibonacci-base string.

geometor.knott.golden_string.from_zeckendorf(bit_str: str) → int

Decode any Fibonacci-base bitstring (with rightmost column \(F_2 = 1\)) into an int.

Parameters:

bit_str – String of '0' and '1' digits.

Returns:

Decoded non-negative integer value.

geometor.knott.golden_string.construct_zeckendorf_staircase_model() → geometor.knott.flat_geometry.GeometricCatalogResult

Construct KNOTT-5.2: Geometric Fibonacci staircase & Zeckendorf decomposition of 12 = 8 + 3 + 1.

Constructs adjacent Fibonacci column rectangles of widths 1 and exact heights \(F_2=1, F_3=2, F_4=3, F_5=5, F_6=8\) in geometor.model, highlighting the non-adjacent columns \(F_6=8, F_4=3, F_2=1\) that compose \(12 = 10101_Z\), alongside a horizontal verification bar of total length 12 partitioned at 8 and 11.

Returns:

Verified GeometricCatalogResult for KNOTT-5.2.

geometor.knott.golden_string.beatty_pair(n: int) → tuple[int, int]

Return Beatty’s complementary Golden pair \((\lfloor n\Phi \rfloor, \lfloor n\Phi^2 \rfloor)\) for \(n \ge 1\).

Uses \(\lfloor n\Phi^2 \rfloor = \lfloor n(\Phi + 1) \rfloor = \lfloor n\Phi \rfloor + n\) and exact integer arithmetic floor_linear_phi().

Parameters:

n – Positive integer (\(n \ge 1\)).

Returns:

Exact integer pair (floor(n * PHI), floor(n * PHI^2)).

geometor.knott.golden_string.wythoff_entry(row: int, col: int) → int

Compute entry W(row, col) (0-indexed) of Morrison’s Wythoff Array.

Matches Dr. Ron Knott’s formula on fibGen.html#wythoffprops: \(W(r, c) = \lfloor (r + 1)\Phi \rfloor F_{c + 2} + r F_{c + 1}\).

Parameters:
  • row – Non-negative row index (\(r \ge 0\)).

  • col – Non-negative column index (\(c \ge 0\)).

Returns:

Positive integer at (row, col) in the Wythoff Array.

geometor.knott.golden_string.wythoff_locate(n: int) → tuple[int, int]

Locate the unique (row, col) (0-indexed) of positive integer n in the Wythoff Array.

Uses the Zeckendorf trailing-zero characterization: col equals the number of trailing '0' digits in to_zeckendorf(), and W(row, 0) increases strictly with row.

Parameters:

n – Positive integer (\(n \ge 1\)).

Returns:

Unique (row, col) pair satisfying wythoff_entry(row, col) == n.

geometor.knott.golden_string.stolarsky_entry(row: int, col: int) → int

Compute entry S(row, col) (0-indexed) of Kenneth Stolarsky’s (1977) Array.

Matches Dr. Ron Knott’s formula on fibGen.html#stolarsky:

  • \(S(r, 0) = r + 1 + \lfloor (r + 1/2)\Phi \rfloor\);

  • \(S(r, 1) = \operatorname{round}(S(r, 0)\Phi) = \lfloor S(r, 0)\Phi + 1/2 \rfloor\);

  • \(S(r, c) = S(r, c - 1) + S(r, c - 2)\) for \(c \ge 2\).

Parameters:
  • row – Non-negative row index (\(r \ge 0\)).

  • col – Non-negative column index (\(c \ge 0\)).

Returns:

Positive integer at (row, col) in Stolarsky’s Array.

geometor.knott.golden_string.construct_wythoff_beatty_model() → geometor.knott.flat_geometry.GeometricCatalogResult

Construct KNOTT-5.3: Wythoff / Beatty slope rays \(y = \Phi x\) & \(y = \Phi^2 x\) and cold positions.

Constructs the two complementary Beatty slope rays \(y = \Phi x\) and \(y = \Phi^2 x\) from O(0,0) alongside Wythoff’s game cold positions \((\lfloor n\Phi \rfloor, \lfloor n\Phi^2 \rfloor)\) for \(n = 1..4\): W1(1,2), W2(3,5), W3(4,7), W4(6,10). Verifies exact bijective partitioning of 1..100 across Beatty’s pair, Wythoff’s Array, and Stolarsky’s Array.

Returns:

Verified GeometricCatalogResult for KNOTT-5.3.