返回题库

判断能否被 9 整除

Division by 9

专题
Brainteaser / 脑筋急转弯
难度
L4

题目详情

给出一个规则:如何判断一个整数是否能被 9 整除?

Give a rule to decide if an integer is divisible by 9.

解析

一个整数能被 9 整除,当且仅当其十进制各位数字之和能被 9 整除。

因为 101(mod9)10\equiv 1\pmod 9,所以

an10n++a110+a0an++a1+a0(mod9).a_n10^n+\cdots+a_110+a_0\equiv a_n+\cdots+a_1+a_0\pmod 9.

Original Explanation

An integer is divisible by 9 if and only if the sum of its digits is divisible by 9. Formally, if the integer is written in decimal as an10n+an110n1++a110+a0,a_n 10^n + a_{n-1} 10^{n-1} + \cdots + a_1 10 + a_0, then it is divisible by 9 exactly when an+an1++a1+a0a_n + a_{n-1} + \cdots + a_1 + a_0 is divisible by 9.