zoukankan      html  css  js  c++  java
  • 简单数论初步

    整除

    定义

    (a,b in mathbb{Z}),且(b eq 0).如果存在(qinmathbb{Z}),使得(a=bq),则(b)整除a,记作(bmid a),此时(b)(a)因数(a)叫做(b)倍数.


    性质

    1

    (如果a mid b 且 bmid c),那么(cmid a)
    证明 : (设an=b, bm=c (n, m in mathbb{Z}).)
    ( herefore c/a = nm.)
    ( herefore cmid a.)

    2

    (如果amid b且amid c,有amid (bx+cy))
    证明:
    (设 as = b, at = c)
    (s,tinmathbb{Z^+})
    ( herefore ast = c)
    ( herefore amid c)

    3

    (如果cmid a, cmid b,那么对于任意m, ninmathbb{Z},有cmid ma+mb).
    证明
    (如果m eq 0,则amid b Leftrightarrow mbmid ma)
    (ecause amid b)
    ( herefore 不妨设an=b)
    ( herefore anm = bm)
    ( herefore n*am = bm)
    ( herefore mbmid ma)

    4

    (如果ax+by=1,amid n, amid n. Rightarrow abmid n).
    证明:
    (设as=n=1, bt=n, s,tinmathbb{Z}且s, t eq 0).
    (ecause ax+by=1).
    ( herefore frac{x}{b} + frac{y}{a}).
    (ecause abmid n)
    ( herefore frac{n}{ab}inmathbb{Z})
    ( herefore n imes frac{1}{ab})
    (=frac{nx}{b}+frac{ny}{a})
    (=tx+sy)

    5

    如果(b=d imes q + c,qinmathbb{Z})
    (dmid c Leftrightarrow dmid b)


    模运算

    定义

    对于整数(a,b (b eq 0)),求(a div b)的余数.记作(a) (mod) (b)((a\%b)).


    性质

    1.分配率

    ((a+b)\%c=(a\%c+b\%c)\%c)
    ((a-b)\%c=(a\%c-b\%c)\%c)
    ((a imes b)\%c=(a\%c imes b\%c)\%c)
    ((a^b)\%c=(a\%b)^b\%c)
    统一证明:
    (ka+m_a=c, kb+m_b=c)
    带入整理可得:
    (Rightarrow(a+b)\%c=(m_a+m_b)%c)
    (Rightarrow(a-b)\%c=(m_a-m_b)%c)
    (Rightarrow(a*b)\%c=(m_a*m_b)%c)
    而幂运算可与看做多个乘法运算


    2.缩放性

    2.1

    (如果a\%b=c,d eq 0)
    (Rightarrow (ab)\%(bd)=cd)
    证明:
    (a=bs+c)
    (Rightarrow ad=(bs+c)d)
    (Rightarrow ad=sbd+cd)
    (Rightarrow (ab)\%(bd)=cd)


    2.2

    (如果a\%b=c,dmid a, dmid b)
    (Rightarrow(a/d)\%(b/d)=(c/d).)
    证明:
    (bs+c=a).
    (frac{b}{d} imes s + frac{c}{d}=frac{a}{d})


    2.3

    (frac{a}{b}\%c=frac{a\%(bc)}{b})
    证明:
    两边同时乘(b),可以得到:
    (a\%(bc)=a\%(bc))

  • 相关阅读:
    编辑器、编译器、文件、IDE等常见概念辨析
    二叉排序树的实现
    模板
    Codeforces Round #690 (Div. 3)
    Educational Codeforces Round 100 (Rated for Div. 2)
    Codeforces 414-B. Mashmokh and ACM(数位dp)
    Codeforces 339D-Xenia and Bit Operations(线段树)
    Educational Codeforces Round 96 (Rated for Div. 2) 题解
    2019-2020 ICPC Northwestern European Regional Programming Contest (NWERC 2019)
    2018-2019 ICPC Northwestern European Regional Programming Contest (NWERC 2018)
  • 原文地址:https://www.cnblogs.com/cqbz-ChenJiage/p/13830365.html
Copyright © 2011-2022 走看看