Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 state

Back to all declarations

selfPath

untyped string

selfPath is this realm's own page. A root-relative link resolves against the domain, not the realm, so every link back into it names it in full.

Value

"/r/moul/x/daily/collatz/v1"

maxIters

untyped bigint

maxIters caps the Collatz walk so a hostile / huge input cannot loop forever on-chain. No known n stays below this bound and fails to reach 1.

Value

(1000000 <untyped> bigint)

MaxResults

untyped bigint

MaxResults bounds the leaderboard's state: anyone may Compute, and each new n is a new entry the root page sorts.

Value

(1000 <untyped> bigint)

maxSeqLen

untyped bigint

maxSeqLen caps how many terms Render("/\<n>") will print.

Value

(500 <untyped> bigint)

Result

type

Result is one recorded submission.

Value

v1.Result

results

v0.Tree

results maps a decimal-string key of N -> Result. avl.Tree keeps a deterministic order for iteration inside Render.

Open
OID
00f2d4…fa70:4
results details

Inspect ref

maxOdd

untyped bigint

maxOdd is the largest odd term whose successor 3n+1 still fits in an int64. Past it the step wraps: 6148914691236517205 maps to exactly 2^64, which is 0, and the walk then spins on 0 until maxIters.

Value

(3074457345618258602 <untyped> bigint)

stopping

func(n int64) (steps int, peak int64, ok bool)

stopping returns the number of steps to reach 1 and the peak value seen, walking the Collatz (hailstone) map. ok is false when a term would overflow int64, in which case steps and peak describe the walk up to that term. It never mutates state.

Open
OID
00f2d4…fa70:5
stopping details

Inspect func

Compute

func(n int)

Compute walks the hailstone sequence for n and records the result attributed to the caller. It is a crossing (state-mutating) func.

Open
OID
00f2d4…fa70:7
Compute details

Inspect func

byLongest

type

byLongest implements sort.Interface, ordering results by steps desc, then peak desc, then n asc for stability.

Value

v1.byLongest

Render

func(path string) string

Render shows the leaderboard at root, or the full hailstone sequence for a given n at path "/\<n>".

Open
OID
00f2d4…fa70:8
Render details

Inspect func

renderLeaderboard

func() string
Open
OID
00f2d4…fa70:9
renderLeaderboard details

Inspect func

renderSequence

func(p string) string
Open
OID
00f2d4…fa70:10
renderSequence details

Inspect func
selfPath : untyped string ="/r/moul/x/daily/collatz/v1"
maxIters : untyped bigint =(1000000 <untyped> bigint)
MaxResults : untyped bigint =(1000 <untyped> bigint)
maxSeqLen : untyped bigint =(500 <untyped> bigint)
Result : type =v1.Result
results : v0.Tree Inspect
maxOdd : untyped bigint =(3074457345618258602 <untyped> bigint)
stopping : func(n int64) (steps int, peak int64, ok bool) Inspect
Compute : func(n int) Inspect
byLongest : type =v1.byLongest
Render : func(path string) string Inspect
renderLeaderboard : func() string Inspect
renderSequence : func(p string) string Inspect