1994个8除以26余数是几

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 07:26:37
1994个8除以26余数是几1994个8除以26余数是几1994个8除以26余数是几写了一小段辅助程序,终于解决了.答案为10.因为每增加一个8,即相当于前N-1个8除以26的余数乘以10加上8再跟2

1994个8除以26余数是几
1994个8除以26余数是几

1994个8除以26余数是几
写了一小段辅助程序,终于解决了.答案为10.
因为每增加一个8,即相当于前N-1个8除以26的余数 乘以10加上8 再跟26算余数.
简而言之,a[n]=(10*a[n-1]+8)%26,a[1]=8.
当有1,2,3,4.个8时,余数为8,10,4,22,20,0的循环.
所以,1994/6 余2,1994个8除以26余数,即为 10.
附上程序(perl)
while(<>){
chomp;
my($a,$b)=split;
print "$a divided by $b remains ".$a%$b."\n";
}
运行结果:
C:\Ren Shirui\Perl>perl testStrict.pl
8 26
8 divided by 26 remains 8
88 26
88 divided by 26 remains 10
888 26
888 divided by 26 remains 4
8888 26
8888 divided by 26 remains 22
88888 26
88888 divided by 26 remains 20
888888 26
888888 divided by 26 remains 0
8888888 26
8888888 divided by 26 remains 8
88888888 26
88888888 divided by 26 remains 10
888888888 26
888888888 divided by 26 remains 4

1944乘以8再除以26=613.5384615

14