0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【第11回】ヒストグラムの山を分けてみる。103を通る群と通らない群

0
Last updated at Posted at 2026-11-17

目次
https://qiita.com/Shamoo/items/c9e43a6f4034f58e1a7e

前の記事
https://qiita.com/Shamoo/items/d08651f4a6b0fddd9e19

概要

第3回では、20以下の奇数を手で並べました。今回は表の範囲を広げます。棒を並べると細かく上下していて、「山って結局いくつあるの?」と思いますよね。まず103を通るかどうかで、同じ表を二つに分けてみます。

ここで $t(x)$ は正奇数の始点 $x$ が通常のコラッツ操作で初めて1に着くまでの回数です。$M_N(t)$ は $N$ 以下の正奇数のうち、時間がちょうど $t$ になるものの個数です。到達していない値は、その時刻の棒に入れません。

103を踏んだら、その後はいつも87回

137から始めると $3\cdot137+1=412=4\cdot103$。普通の操作では $137\to412\to206\to103$ の3回で103です。その先の103から1までは、奇数から奇数への反復が31回、2で割る操作が56回。したがって $t(137)=3+87=90$ です。103そのものは0回目に103を訪れるので $t(103)=87$。どの始点でもいったん103を踏めば、残りはこの87回です。

従って、103を通る群の棒は、最初に103に着くまでの回数の表を、横に87だけずらしたものです。103に先に着いた経路が1を経由済みということはありません。1に着いた後は $1\to4\to2\to1$ の繰り返しだからです。103を通らない群を元の表から引けば、重複なく二つに分かれます。

図では、10万以下の正奇数を使いました。上段の細い線は元の各時刻の個数、青は103を通らない群、茶は通る群をガウス平滑化したものです。ここでの平滑化は、前後32時刻に幅パラメーター8の重みを掛けて平均する計算です。青の最大は69、茶の最大は153、両群を合わせて平滑化した最大は69です。50,000個の始点のうち15,089個が103を通りました。

11_histogram_through_103.png

図を作るPythonコード
from collections import Counter

import matplotlib.pyplot as plt
import numpy as np


def odd_step(n):
    value = 3*n + 1
    divisions = (value & -value).bit_length() - 1
    return value >> divisions, divisions


def evaluate(start, memo):
    value = start
    path = []
    while value not in memo:
        new, divisions = odd_step(value)
        path.append((value, divisions))
        value = new
    time, depth, through = memo[value]
    for value, divisions in reversed(path):
        time += divisions + 1
        depth += 1
        through = through or value == 103
        if value <= bound:
            memo[value] = time, depth, through
    return time, depth, through


def gaussian_smooth(values, sigma):
    offsets = np.arange(-4*sigma, 4*sigma + 1)
    kernel = np.exp(-offsets**2 / (2*sigma**2))
    return np.convolve(values, kernel/kernel.sum(), mode="same")


bound = 100_000
memo = {1: (0, 0, False)}
crossed, avoided, fully_included = Counter(), Counter(), Counter()
for start in range(1, bound + 1, 2):
    time, depth, through = evaluate(start, memo)
    (crossed if through else avoided)[time] += 1
    if 2**(time-depth) <= bound * 3**depth:
        fully_included[time] += 1

assert memo[103] == (87, 31, True)
assert sum(crossed.values()) + sum(avoided.values()) == (bound+1)//2
times = np.arange(max(crossed | avoided) + 1)
seen = np.array([crossed[t] for t in times])
unseen = np.array([avoided[t] for t in times])
total = seen + unseen
full = np.array([fully_included[t] for t in times])
assert np.all(full <= total)

fig, (top, bottom) = plt.subplots(2, 1, figsize=(9, 7.2), sharex=True, layout="constrained")
top.plot(times, total, color="#8796ac", linewidth=0.9, label="Exact count (unsmoothed)")
top.plot(times, gaussian_smooth(unseen, 8), color="#2b6a9e", linewidth=2.2, label="Avoids 103")
top.plot(times, gaussian_smooth(seen, 8), color="#a44528", linewidth=2.2, label="Visits 103")
top.set(title="Stopping-time counts for odd starts up to 100,000", ylabel="Starts per time")
bottom.plot(times, gaussian_smooth(total, 8), color="#214159", linewidth=2.3, label="All starts")
bottom.plot(times, gaussian_smooth(full, 8), color="#673f92", linewidth=2.2, linestyle="--",
            label="Fully included layers")
bottom.fill_between(times, gaussian_smooth(full, 8), gaussian_smooth(total, 8),
                    color="#dec7ef", alpha=0.75, label="Boundary-layer contribution")
bottom.set(xlabel="Ordinary steps to 1", ylabel="Smoothed counts")
for axis in (top, bottom):
    axis.grid(axis="y", alpha=0.22)
    axis.set_axisbelow(True)
    axis.spines[["top", "right"]].set_visible(False)
    axis.legend(frameon=False, loc="upper right")
top.set_xlim(0, 330)
fig.savefig("11_histogram_through_103.png", dpi=175)
plt.close(fig)
print("Unsmoothed starts:", int(total.sum()), "| visits 103:", int(seen.sum()))
for label, data in [("avoids", unseen), ("visits", seen), ("all", total), ("full", full)]:
    print(label, "largest smoothed value occurs at", int(np.argmax(gaussian_smooth(data, 8))))

始点の上限で切れる層はどこ?

図の下段は同じ表の別の分け方です。1へ初到達する軌道について、奇数から奇数への反復を $s$ 回、2による総除算を $V$ 回と書きます。総停止時間は $t=s+V$。同じ $s,V$ を持つ始点をひとまとめにしたものを、ここでは層と呼びます。

軌道の正奇数を順に $x_0=x,x_1,\ldots,x_s=1$ とすると、各段で $3x_j+1=3x_j(1+1/(3x_j))$ です。つないで割り算を整理すると

B=\frac{2^V}{3^s}=\frac{2^t}{6^s}
=x\prod_{j=0}^{s-1}\left(1+\frac1{3x_j}\right)

になります。だから $B\le N$ なら、その層の始点は全部入ります。例えば始点5の層では $s=1,V=4$ なので $B=16/3$。上限20ならこの層は全部入ります。図の下段は、全部入ると分かった層だけの集計と、実際の上限付きの集計を比べています。色を塗った部分は、後者にだけ入っている分です。

一方で、$x>1$ の初到達について $s\le400$ の範囲では、研究で $x<B<1.255x$ を認証しました。$1.255N\le B$ の層からは始点が入りません。従って一部だけ入る候補は $N<B<1.255N$。時刻 $t$ を固定して $s$ を1増やすと $B$ はちょうど6分の1になるので、この細い範囲に入る候補は高々一つです。$s\le400$ という範囲が、この切り分けの前提です。

10の8乗で見えたこと

以前の $N=10^8$ の集計では、ガウス平滑化の幅を8にし、系列の最大値の1%以上の突出度を持つ極大を「山」と数えました。「上限内に全部入る層だけ」では147と187、上限を厳密に判定した全体では169に山が出ました。103を通らない群と通る群の最大は、それぞれ136と218でした。境界の層が結果を変える例として、163では平滑化後の差が約4.9万出ています。

今回は図を貼り直すときに自分で回せるよう、10万の例を載せました。山の位置は始点上限と平滑化で変わりますし、二群の最大位置が離れていても、二群を足した図で二つの山が見えるとは限りません。

始点上限を外したときの増大率

ここからは別の計数です。$N_{\mathrm{odd}}(t)$ を、始点上限を設けず、総停止時間がちょうど $t$ である正奇数の数とします。例えば $t=7$ の始点は3と21。上限20の図だと21が消えるので、$M_{20}(7)=1$ でした。この差を先に確認しておくと、増大率の図が読みやすくなります。

逆枝の重みを法9の類で足して得られた無条件の評価は、

\rho_+^{-1}\le\liminf_{t\to\infty}N_{\mathrm{odd}}(t)^{1/t}
\le\limsup_{t\to\infty}N_{\mathrm{odd}}(t)^{1/t}\le\rho_-^{-1}

です。$\rho_-$ と $\rho_+$ はそれぞれ $u^3+u^4+u^6=1$ と $u^5+2u^6=1$ の $0<u<1$ の根。逆数の両端は約1.21486と1.30408です。元の研究では、さらに法2187と法6561で逆枝を集約した有限証明書から区間を約 $[1.26323555048,\,1.26433119409]$ に狭めました。図では手計算の式に戻りやすい前者の両端を描いています。点は初到達だけを逆枝で列挙した有限計算です。水平線は極限側の評価なので、小さい時刻の点が線の間にある必要はありません。

12_half_point_distribution.png

図を作るPythonコード
from collections import Counter

import matplotlib.pyplot as plt


def reverse_counts(horizon):
    counts = Counter({0: 1})

    def visit(end, time):
        if end % 3 == 0:
            return
        for divisions in range(1, horizon-time):
            numerator = 2**divisions * end - 1
            if numerator % 3:
                continue
            start = numerator // 3
            if start == 1:
                continue
            total = time + divisions + 1
            counts[total] += 1
            visit(start, total)

    visit(1, 0)
    return counts


def solve(unit_sum):
    lo, hi = 0.0, 1.0
    for _ in range(52):
        mid = (lo+hi)/2
        if unit_sum(mid) < 1:
            lo = mid
        else:
            hi = mid
    return (lo+hi)/2


horizon = 46
counts = reverse_counts(horizon)
assert counts[5] == 1 and counts[7] == 2
times = [time for time in range(5, horizon + 1) if counts[time]]
observed = [counts[time]**(1/time) for time in times]
lower = 1/solve(lambda z: z**5 + 2*z**6)
upper = 1/solve(lambda z: z**3 + z**4 + z**6)
assert 1 < lower < upper

fig, ax = plt.subplots(figsize=(8, 4.7), layout="constrained")
ax.plot(times, observed, color="#254f77", marker="o", markersize=3.8, label="Finite calculation")
ax.axhline(lower, color="#a44528", linestyle="--", label=f"Asymptotic lower bound {lower:.4f}")
ax.axhline(upper, color="#673f92", linestyle="--", label=f"Asymptotic upper bound {upper:.4f}")
ax.set(title="Starts with exact total stopping time, no start cutoff",
       xlabel="Ordinary steps to 1", ylabel=r"Count$^{1/t}$")
ax.grid(axis="y", alpha=0.22)
ax.spines[["top", "right"]].set_visible(False)
ax.legend(frameon=False)
fig.savefig("11_growth_rate.png", dpi=175)
plt.close(fig)
print("Growth bounds:", lower, upper, "| exact counts at time 5 and 7:", counts[5], counts[7])
逆枝の何を足したの?

通常の操作を1回進むごとに重み $u$ を掛けます。3で割れない奇数の逆枝では、さらに3で割れない子へ行くものを選びます。法3の1の頂点の重みを1、法3の2なら $u^{-1}$ とすると、親に対する子の重みの和は、法9の類 $\{1,2\},\{4,8\},\{5,7\}$ に対してそれぞれ

\frac{u^3+u^4}{1-u^6},\quad
\frac{u^2+u^7}{1-u^6},\quad
\frac{u^5+u^6}{1-u^6}

です。例えば親が1なら、3で割れない子へ行く除算回数は2と4を法6とした類です。回数2では子が1 mod 3、回数4では子が2 mod 3になるため、重みは $u^3$ と $u^5u^{-1}=u^4$。残りは6刻みの等比級数です。上界は全行で重量が減る範囲を使います。下界は全行で重量を保つ有限本の枝を選び、境界の到達候補を指定時刻まで延ばす写し方を使います。有限の増大率の図はこの証明には使いません。

別の計算では、始点を法3で分けた母関数の恒等式から、$(3+\sqrt{21})/6\simeq1.26376$ が候補になります。

(知ってる人は知っている、コラッツ定数と同じものです。詳しくはオンライン数列大辞典のA176014を参照)

候補値を厳密な漸近増大率とするには、剰余類ごとの誤差の解析接続と極での非消滅の仮定が残ります。有限ヒストグラムの山の位置を説明する課題と、どちらもここから先です。

次回

参考

  • 岡 將太・岡 万桜「コラッツ予想のステップ数(総停止時間)について」第4・5節、続編第8節。
  • 旧定理一覧 T-019〜T-024、T-251・T-252、旧予想一覧 C-041・C-129。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?