For faster navigation, this Iframe is preloading the Wikiwand page for 余数.

余数

此条目需要扩充。 (2013年2月15日)请协助改善这篇条目,更进一步的信息可能会在讨论页扩充请求中找到。请在扩充条目后将此模板移除。
此条目没有列出任何参考或来源。 (2012年11月28日)维基百科所有的内容都应该可供查证。请协助补充可靠来源改善这篇条目。无法查证的内容可能会因为异议提出而被移除。

算术中,当两个整数的结果不能以整数表示时,余数便是其“余留下的量”。当余数为零时,被称为整除

自然数的余数

如果 是两个自然数 非0,可以证明存在两个唯一的整数 ,满足 。其中, 被称为商数 被称为余数带余除法是一个关于如何计算余数的算法,其中提供了对此结果的证明。

例子

  • 13除以10,商为1,余数为3,
  • 26除以4,商为6,余数为2,
  • 56除以7,商为8,余数为0,
  • 9除以10,商为0,余数为9,

一般整数的余数

如果 是整数, 非零,那么余数 满足这样的关系:

, 为整数,且

当这样定义时,可能导致两种可能的余数。例如,除法式子的可以表达为

(在数学工作者中使用较多)

.

即余数可能是3或−2。

这种对余数不明确的定义可能导致严重的计算问题,对于处理关键任务的系统,错误的选择会导致严重的后果。在一些组合语言系统中,会有特殊的除法指令,设定余数和被除数同号。

在上面的例子,负余数为正余数减5得来,5即是除数 。通常,当除以 时,如果正余数为,负余数为,那么

Python 2.7语言定义的除法中,不能整除的情况下,余数与除数同号,例如表达为

则表达为

实数的余数

实数,且 非零, 除以 会得到另一个实数(商),没有所谓的剩余的数.但如果要求商为一个整数,则余数的概念还是有必要的。可以证明:存在唯一的整数商 和唯一的实数r 使得:, 。在整数除法里,余数可以要求为负,即满足关系:

如上在实数范围内扩展余数的定义在数学理论中并不重要;尽管如此,很多程序语言都实现了这个定义—参同余

参见

{{bottomLinkPreText}} {{bottomLinkText}}
余数
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?