以下是引用Andy15在2004-8-20 13:05:50的发言:
is this method faster than brutal force? i seriously doubt so. btw, a slightly faster method would be:
1st digit + 3 times the 2nd digit + 2 times the 3rd digit - the 4th digit - 3 times the 5th digit - 2 times the 6th digit. And then we repeat the sequence, + the 7th digit + 3 times the 8th digit, etc. If the whole "sum" is divisible by 7, then the original number is divisible by 7.
4712954379
9+3(7)+2(3)-4-3(5)-2(9)+2+3(1)+2(7)-4=14
and since 14 is divisible by 7, the original number is divisible by 7. But again this might not be faster than the brutal force way.
i come back home once a year normally. my question is What is the most efficient way to forget a past relationship?
这种方法比较适合数位较小的数字,而徒弟出的题目数字太大,如果一个个算太麻烦啦!n位数就要计算2n次(乘法n次,加减法n次)。1001法要计算的次数是n/3次(3位数的加减法,故n/3次),明显计算次数少,不过只是三位数加减法略微麻烦一点。根据情况分析啦!不过最简单的肯定还是去末位法,但是只适合小数字。
想忘掉关系,就自杀吧!一了百了。
[em01][em01][em01]
楼下的,午饭吃什么了?
[此贴子已经被作者于2004-8-20 13:42:40编辑过] |