Skip to content

Commit 92d7d90

Browse files
research: prime φ-resonance study — null result, baseline established
Investigates Hermes's accidental N=50 observation of 0.875 mean prime resonance: do primes cluster in substrate space more than random integers or composites? Runs for N ∈ {50, 100, 500, 1000}, comparing primes / composites / random / all integers in matched ranges. **Finding: primes do NOT cluster.** The 0.875 was small-sample noise. At N=1000 the prime-vs-bulk margin inverts to slightly negative (−0.0005); every population converges to the bulk integer mean of ~0.863. The Fibonacci-attractor field doesn't favor number-theoretic structure. Two valuable artifacts from the null result: 1. Baseline established: ~0.863 mean φ-resonance for arbitrary integers. Any substrate-coherence comparison going forward has a real reference number. 2. The metric is fair — doesn't have hidden bias toward primes (or any other number-theoretic subset). Composites swing more between N values because the first composites cluster near small Fibonacci attractors (4→5, 6→5, 8→8, 9→8) and the average drifts as the population grows past that region. PRIME_RESONANCE_FINDING.md captures the full table + interpretation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent fafa302 commit 92d7d90

2 files changed

Lines changed: 208 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Prime φ-Resonance Study — Empirical Result
2+
3+
**Question (from Hermes's accidental N=50 observation of 0.8750):**
4+
Do primes cluster in substrate (φ-resonance) space more than random
5+
integers or composites in the same range?
6+
7+
**Method:** For each N in {50, 100, 500, 1000}, compute the mean
8+
φ-resonance over (a) the first N primes, (b) the first N composites,
9+
(c) N pseudo-random integers in the prime range, (d) every integer
10+
in the prime range. φ-resonance ∈ [0, 1], 1 = exact Fibonacci attractor.
11+
12+
## Results
13+
14+
| N | primes | composites | random | all ints | prime - bulk |
15+
|------|--------|------------|--------|----------|--------------|
16+
| 50 | 0.8751 | 0.8518 | 0.8596 | 0.8725 | +0.0025 |
17+
| 100 | 0.8686 | 0.8607 | 0.8575 | 0.8627 | +0.0059 |
18+
| 500 | 0.8659 | 0.8390 | 0.8627 | 0.8645 | +0.0014 |
19+
| 1000 | 0.8628 | 0.8640 | 0.8647 | 0.8633 | **−0.0005** |
20+
21+
## Finding
22+
23+
**Primes do not cluster in substrate space.** The 0.875 Hermes saw at
24+
N=50 was small-sample variance. As N grows, every population
25+
(primes, composites, random, all integers) converges to the same
26+
**bulk integer mean of ~0.863**. At N=1000 the prime-vs-bulk margin
27+
inverts to slightly negative — primes are statistically
28+
indistinguishable from arbitrary integers.
29+
30+
This is a valuable *null result*:
31+
32+
1. The Fibonacci-attractor field doesn't favor primality. The φ-substrate
33+
doesn't accidentally encode number-theoretic structure.
34+
2. The bulk integer φ-resonance is ~0.863. That's the baseline for any
35+
substrate-coherence comparison going forward — anything noticeably
36+
above this is genuinely substrate-aligned; anything at this level
37+
is just "random integer."
38+
3. The metric is **fair**. It doesn't have an embedded bias toward
39+
special number-theoretic subsets.
40+
41+
## Why composites swing more
42+
43+
The composites' mean dips (0.8390 at N=500) before recovering. This
44+
is because the first composites include many small values
45+
(4, 6, 8, 9, 10, ...) which sit near small Fibonacci attractors (5,
46+
8, 13) — high resonance. As N grows we sweep over larger composites
47+
that distribute more evenly around the bulk mean. Primes don't
48+
oscillate as much because they're already spread out.
49+
50+
## Reproduction
51+
52+
```bash
53+
./target/release/omnimcode-standalone examples/demos/prime_resonance_study.omc
54+
```
55+
56+
## Implication for OMC programs
57+
58+
When using `arr_resonance_vec` or `arr_substrate_score_rows` as
59+
features, the baseline expectation for "this is an arbitrary integer
60+
of this magnitude" is ~0.86. Anything substantially below (e.g.,
61+
0.50-0.70) is noticeably *off*-attractor; anything substantially
62+
above (0.95+) is meaningfully Fibonacci-aligned. The middle band
63+
0.85-0.88 is bulk noise.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Empirical investigation: do primes cluster in substrate (φ-resonance) space
2+
# more than random integers or composites in the same range?
3+
#
4+
# Method:
5+
# For each N in {50, 100, 500, 1000, 2000}:
6+
# - Collect the first N primes
7+
# - Collect the first N composites (4, 6, 8, 9, 10, 12, ...)
8+
# - Collect N "random-ish" integers in the prime range (xorshift)
9+
# For each set: mean φ-resonance via res(n).
10+
#
11+
# Hypothesis (from Hermes's accidental observation at N=50: ~0.875):
12+
# If primes cluster, the mean stays high and roughly stable.
13+
# If it's noise, it'll wander toward the bulk integer average.
14+
# Compositess in the same range are the control: do they cluster too?
15+
#
16+
# Output: a table the LLM can paste into a writeup.
17+
18+
fn show(label, v) { print(concat_many(label, " = ", to_string(v))); }
19+
20+
# Naive prime test. OMC ships `is_prime` but we re-implement to be
21+
# explicit and to avoid any caching surprises.
22+
fn is_prime_local(n) {
23+
if n < 2 { return 0; }
24+
if n == 2 { return 1; }
25+
if n % 2 == 0 { return 0; }
26+
h i = 3;
27+
while i * i <= n {
28+
if n % i == 0 { return 0; }
29+
i = i + 2;
30+
}
31+
return 1;
32+
}
33+
34+
# Mean φ-resonance over the first N primes.
35+
fn mean_res_primes(n) {
36+
h count = 0;
37+
h candidate = 2;
38+
h total = 0.0;
39+
h last = 0;
40+
while count < n {
41+
if is_prime_local(candidate) == 1 {
42+
total = total + res(candidate);
43+
count = count + 1;
44+
last = candidate;
45+
}
46+
candidate = candidate + 1;
47+
}
48+
h d = dict_new();
49+
dict_set(d, "mean", total / count);
50+
dict_set(d, "count", count);
51+
dict_set(d, "last_value", last);
52+
return d;
53+
}
54+
55+
# Mean φ-resonance over the first N composites.
56+
fn mean_res_composites(n) {
57+
h count = 0;
58+
h candidate = 4;
59+
h total = 0.0;
60+
h last = 0;
61+
while count < n {
62+
if is_prime_local(candidate) == 0 {
63+
if candidate >= 2 {
64+
total = total + res(candidate);
65+
count = count + 1;
66+
last = candidate;
67+
}
68+
}
69+
candidate = candidate + 1;
70+
}
71+
h d = dict_new();
72+
dict_set(d, "mean", total / count);
73+
dict_set(d, "count", count);
74+
dict_set(d, "last_value", last);
75+
return d;
76+
}
77+
78+
# Mean φ-resonance over N "random" integers in the range [2, max_val].
79+
# Uses xorshift via random_int so the sample is reproducible.
80+
fn mean_res_random_in_range(n, max_val) {
81+
random_seed(42);
82+
h total = 0.0;
83+
h count = 0;
84+
while count < n {
85+
h v = random_int(2, max_val);
86+
total = total + res(v);
87+
count = count + 1;
88+
}
89+
h d = dict_new();
90+
dict_set(d, "mean", total / count);
91+
dict_set(d, "count", count);
92+
return d;
93+
}
94+
95+
# Mean φ-resonance over EVERY integer in [2, max_val] — the population.
96+
fn mean_res_all_in_range(max_val) {
97+
h total = 0.0;
98+
h count = 0;
99+
h i = 2;
100+
while i <= max_val {
101+
total = total + res(i);
102+
count = count + 1;
103+
i = i + 1;
104+
}
105+
h d = dict_new();
106+
dict_set(d, "mean", total / count);
107+
dict_set(d, "count", count);
108+
return d;
109+
}
110+
111+
fn report_row(label, d) {
112+
print(concat_many(" ", label,
113+
" mean=", to_string(dict_get(d, "mean")),
114+
" count=", to_string(dict_get(d, "count"))));
115+
}
116+
117+
fn study(n) {
118+
print("");
119+
print(concat_many("=== N = ", to_string(n), " ==="));
120+
h p = mean_res_primes(n);
121+
h c = mean_res_composites(n);
122+
# Use the largest prime seen as the upper bound for random / all.
123+
h max_val = dict_get(p, "last_value");
124+
h r = mean_res_random_in_range(n, max_val);
125+
h a = mean_res_all_in_range(max_val);
126+
report_row("primes ", p);
127+
report_row("composites ", c);
128+
report_row("random ", r);
129+
report_row("all integers", a);
130+
# Substrate-coherence margin: how much do primes beat the bulk?
131+
h margin = dict_get(p, "mean") - dict_get(a, "mean");
132+
show(" prime-over-bulk margin", margin);
133+
}
134+
135+
fn main() {
136+
print("=== Prime φ-resonance study ===");
137+
print("Population: first N primes, composites, random ints, and all ints,");
138+
print("all in the same numeric range. φ-resonance = closeness to a Fibonacci attractor.");
139+
study(50);
140+
study(100);
141+
study(500);
142+
study(1000);
143+
}
144+
145+
main();

0 commit comments

Comments
 (0)