二元可分10 [英] Binary divisibility by 10

查看:133
本文介绍了二元可分10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查是否一个二进制数可以用10分(十进制10;无需将其转换为其他系统OFC :))结果?
例如,我们有号:结果
1010 1011 0100 0001 0000 0100结果
我们如何可以检查这个数字是被10整除?结果
先谢谢了。


解决方案

  

首先将数字拆分奇数和偶数位(我打电话连的
  相应的,甚至2的幂)位:


  
  

100100110010110000000101101110
      0 1 0 1 0 0 1 0 0 0 1 1 0 1 0甚至1 0 0 1 0 1 1 0 0 0 0 0 1 1 1奇


  
  

现在在每个这些,添加和交替减去数字,如在
  可分割为十进制标准测试11(从
  另外在右侧):


  
  

100100110010110000000101101110 + 0-1 + 0-1 + 0-0 + 1-0 + 0-0 + 1-1 + 0-1 + 0 =
  2 + 1-0 + 0-1 + 0-1 + 1-0 + 0-0 + 0-0 + 1-1 + 1 = 1


  
  

现在的两倍的奇数数字的总和并将其添加到偶数的总和
  数字:


  
  

2 * 1 + -2 = 0


  
  

如果结果是由5整除,因为在这种情况下,该数字本身是
  5整除。


  
  

由于该号码也是由2(最右边的数字整除的幸福
  0),它由10整除。


http://mathforum.org/library/drmath/view/55908.html

How to check if a binary number can be divided by 10 (10 in decimal; without converting it to other system ofc. :))?
For example, we have number:
1010 1011 0100 0001 0000 0100
How we can check that this number is divisible by 10?
Thanks in advance.

解决方案

First split the number into odd and even bits (I'm calling "even" the bits corresponding to even powers of 2):

100100110010110000000101101110 0 1 0 1 0 0 1 0 0 0 1 1 0 1 0 even 1 0 0 1 0 1 1 0 0 0 0 0 1 1 1 odd

Now in each of these, add and subtract the digits alternately, as in the standard test for divisibility by 11 in decimal (starting with addition at the right):

100100110010110000000101101110 +0-1+0-1+0-0+1-0+0-0+1-1+0-1+0 = -2 +1-0+0-1+0-1+1-0+0-0+0-0+1-1+1 = 1

Now double the sum of the odd digits and add it to the sum of the even digits:

2*1 + -2 = 0

If the result is divisible by 5, as in this case, the number itself is divisible by 5.

Since this number is also divisible by 2 (the rightmost digit being 0), it is divisible by 10.

http://mathforum.org/library/drmath/view/55908.html

这篇关于二元可分10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆