5D Library › 姓名笔画、生命灵数与手机号码的同余映射和分布论 · English

第一章 数字根就是模 9 的余数

把一个数的各位相加

生命灵数的基本操作是把一个数的各位数字相加,若结果不止一位就再加一次,直到剩下一位数。这个操作称为数字根,它有一个简单的闭式:对正整数 nn,

dr(n)=1+((n−1)mod⁡9).\mathrm{dr}(n) = 1 + ((n – 1) \bmod 9).

理由是 10≡1(mod⁡9)10 \equiv 1 \pmod 9,所以 10k≡110^k \equiv 1,一个数与它的各位数字之和除以 9 的余数相同 (Hardy and Wright 2008)。古代算家用这一点「去九验算」:加法与乘法的结果,其数字根等于各因子数字根的和与积再取数字根。换言之,数字根是从整数环到模 9 剩余类环的同态,可以按任意顺序、对任意分组先取再算。

推导

# Chapter 1. The digital root is the residue modulo 9.
# dr(n) = 1 + ((n - 1) mod 9) for n >= 1. Repeated digit sums give the
# same value because 10 = 1 (mod 9), so a number and its digit sum leave
# the same remainder. The rule is a ring homomorphism, so it can be
# applied to the parts of a date in any order. The master-number rule
# (stop at 11, 22 or 33) is not: it reads digits, not residues.

def digit_sum(n):
    return sum(int(c) for c in str(n))

def reduce_plain(n):
    while n > 9:
        n = digit_sum(n)
    return n

def dr(n):
    return 1 + (n - 1) % 9

def reduce_master(n, masters=(11, 22, 33)):
    while n > 9 and n not in masters:
        n = digit_sum(n)
    return n

if __name__ == "__main__":
    N = 100000
    same = sum(reduce_plain(n) == dr(n) for n in range(1, N + 1))
    print("   iterated digit sum = 1 + (n-1) mod 9 for n = 1..{:,d}: {}"
          .format(N, same == N))
    add = all(dr(a + b) == dr(dr(a) + dr(b))
              for a in range(1, 300) for b in range(1, 300))
    mul = all(dr(a * b) == dr(dr(a) * dr(b))
              for a in range(1, 300) for b in range(1, 300))
    print("   dr(a+b) = dr(dr(a)+dr(b)): {};  dr(ab) = dr(dr(a)dr(b)): {}"
          .format(add, mul))
    print("\n   numbers with the same residue, under the master rule:")
    print("     n    residue  plain  master")
    for n in (11, 20, 29, 38, 47, 22, 13, 33, 15, 42):
        print("   {:4d}   {:5d}   {:5d}  {:6d}".format(
            n, n % 9, reduce_plain(n), reduce_master(n)))
    # a date read three ways: 26 February 1985
    y, m, d = 1985, 2, 26
    whole = digit_sum(y) + digit_sum(m) + digit_sum(d)
    parts = reduce_master(y) + reduce_master(m) + reduce_master(d)
    print("\n   26-02-1985: all digits summed = {} -> {};".format(
        whole, reduce_master(whole)))
    print("               parts reduced first = {} -> {};  plain dr = {}"
          .format(parts, reduce_master(parts), dr(y + m + d)))
    print("\nReading: the digital root is a residue and can be taken in any")
    print("order. The master rule gives 11 for 11, 29, 38 and 47 but 2 for")
    print("20, although all five leave remainder 2: it depends on the route")
    print("through the digits, so the same date can give 33 or 6.")
#    iterated digit sum = 1 + (n-1) mod 9 for n = 1..100,000: True
#    dr(a+b) = dr(dr(a)+dr(b)): True;  dr(ab) = dr(dr(a)dr(b)): True
#
#    numbers with the same residue, under the master rule:
#      n    residue  plain  master
#      11       2       2      11
#      20       2       2       2
#      29       2       2      11
#      38       2       2      11
#      47       2       2      11
#      22       4       4      22
#      13       4       4       4
#      33       6       6      33
#      15       6       6       6
#      42       6       6       6
#
#    26-02-1985: all digits summed = 33 -> 33;
#                parts reduced first = 15 -> 6;  plain dr = 6
#
# Reading: the digital root is a residue and can be taken in any
# order. The master rule gives 11 for 11, 29, 38 and 47 but 2 for
# 20, although all five leave remainder 2: it depends on the route
# through the digits, so the same date can give 33 or 6.

程序在前十万个正整数上验证了闭式,并验证了加法与乘法的同态性质。由此推出一个直接的后果:把出生日期的年、月、日分开先化简、再相加,与把八个数字一次加完,余数必然相同。若只用数字根,生命灵数与「怎样加」无关。

大师数的停止规则

流行的生命灵数在化简过程中保留 11、22、33 三个「大师数」:数字之和一旦等于其中之一就停止,不再相加 (Dudley 1997)。这条规则读的是数字,而不是余数。程序列出的例子说明了这一点:11、20、29、38、47 除以 9 都余 2,按数字根都是 2;按大师数规则,11、29、38、47 都停在 11(29 与 38 的数字和是 11,47 的数字和也是 11),只有 20 落到 2。

因此,同一个日期的生命灵数取决于化简的路径。程序中的 1985 年 2 月 26 日:八个数字一次加完得 33,停在大师数 33;先把年、月、日分别化简再相加得 15,再化为 6;纯数字根也是 6。33 与 6 同余,但印出来是两个不同的数,而流行的解读把它们当作两种不同的人。

四种通行算法

通行的书籍与软件至少有四种算法:

  • A: 把日期的全部数字相加,再化简,遇到 11、22、33 停止;
  • B: 年、月、日分别化简(保留 11、22),相加后再化简,遇到大师数停止;
  • C: 把年、月、日作为整数相加(如 1985 + 2 + 26),再按停止规则化简;
  • D: 纯数字根,没有大师数。

下面的程序逐日比较 1900 年到 2099 年的全部日期。

推导

# Chapter 1. Four published ways to compute a life path number.
# A  sum every digit of the date, then reduce, stopping at 11/22/33
# B  reduce year, month and day separately (keeping 11 and 22), add,
#    then reduce, stopping at 11/22/33
# C  add year + month + day as numbers, then reduce with the stop rule
# D  plain digital root, no master numbers
# All four agree modulo 9 on every date. We count, over every day from
# 1 January 1900 to 31 December 2099, how often they give different
# printed numbers.
import datetime as dt

MASTERS = (11, 22, 33)

def digit_sum(n):
    return sum(int(c) for c in str(n))

def red(n):
    while n > 9 and n not in MASTERS:
        n = digit_sum(n)
    return n

def conventions(y, m, d):
    a = red(digit_sum(y) + digit_sum(m) + digit_sum(d))
    b = red(red(y) + red(m) + red(d))
    c = red(y + m + d)
    e = 1 + (y + m + d - 1) % 9
    return {"A": a, "B": b, "C": c, "D": e}

def all_dates(y0=1900, y1=2099):
    d, end = dt.date(y0, 1, 1), dt.date(y1, 12, 31)
    while d <= end:
        yield d
        d += dt.timedelta(days=1)

if __name__ == "__main__":
    keys = "ABCD"
    n = 0
    master = {k: 0 for k in keys}
    differ = {(p, q): 0 for i, p in enumerate(keys) for q in keys[i + 1:]}
    mod_ok = True
    for day in all_dates():
        v = conventions(day.year, day.month, day.day)
        n += 1
        for k in keys:
            master[k] += v[k] in MASTERS
        for p, q in differ:
            differ[p, q] += v[p] != v[q]
        mod_ok &= len({x % 9 for x in v.values()}) == 1
    print("   {:,d} dates; all four agree modulo 9 on every date: {}"
          .format(n, mod_ok))
    print("   share of dates given a master number (11, 22 or 33):")
    for k in keys:
        print("     {}: {:.4f}".format(k, master[k] / n))
    print("   share of dates on which two conventions print different"
          " numbers:")
    for (p, q), c in differ.items():
        print("     {} vs {}: {:.4f}".format(p, q, c / n))
    print("\nReading: the conventions never disagree about the residue; they")
    print("disagree only about whether to stop at a master number, and the")
    print("same birthday is a master number under one rule and not another.")
#    73,049 dates; all four agree modulo 9 on every date: True
#    share of dates given a master number (11, 22 or 33):
#      A: 0.1476
#      B: 0.1002
#      C: 0.0956
#      D: 0.0000
#    share of dates on which two conventions print different numbers:
#      A vs B: 0.1420
#      A vs C: 0.1608
#      A vs D: 0.1476
#      B vs C: 0.1130
#      B vs D: 0.1002
#      C vs D: 0.0956
#
# Reading: the conventions never disagree about the residue; they
# disagree only about whether to stop at a master number, and the
# same birthday is a master number under one rule and not another.

四种算法在每一个日期上都同余,这是同态性质的保证。它们的分歧完全来自停止规则:按算法 A,0.1476 的日期得到大师数;按 B 与 C,分别为 0.1002 与 0.0956;按 D 为零。两两比较,最少有 0.0956 的日期、最多有 0.1608 的日期得到不同的数。也就是说,任意挑一个生日,不同的书或软件给出不同生命灵数的机会在一成到一成六之间,而这不是任何一方算错,是约定不同。

注

这对软件意味着什么。 一个测算软件应当写明它用的是哪一种算法。用户若在两个软件上得到不同的生命灵数,十有八九不是生日输错,而是两者对大师数的处理不同。第八章的检验方案要求事先登记这一选择。

小结

数字根是模 9 的余数,是一个环同态,可以按任意顺序计算。大师数的停止规则读的是数字的书写而不是余数,所以同一个日期可以得到 33 或 6,取决于先加什么。在 1900 年到 2099 年的全部日期中,四种通行算法两两之间在 0.0956 到 0.1608 的日期上给出不同的数,但从不在余数上矛盾。

参考文献

Dudley, Underwood. 1997. Numerology: Or What Pythagoras Wrought. Mathematical Association of America.
Hardy, G. H., and E. M. Wright. 2008. An Introduction to the Theory of Numbers. 6th ed. Oxford University Press.

Fan, Y. (2026). Modular Numerology, Character-Stroke Hashes and Residue-Class Distributions: Digital-Root Arithmetic, Kangxi Radical Restorations, Modulo-80 Grid Mappings and Empirical Base-Rate Concentration [姓名笔画、生命灵数与手机号码的同余映射和分布论] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090178 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).