|
-
Sep 13th, 2002, 02:25 AM
#1
Originally posted by bugzpodder
right most non-zero digit? easy.
of course you need to use a program to do it.
loop from 1 to N {i}
lets say 'i' is divisible by 2^a, where a is the largest integer such that 2^a<i
and 'i' is divisible by 2^b, where b is the largest integer such that 2^b<i
k=(k*i/(2^a*5^b)) mod 10
numberOfTwo+=a
numberOfFive+=b
}
loop from 1 to numberOfTwo-numberOfFive
k=(k*2)mod 10
and k would be the right-most non-zero digit
if you wrote ...and 'i' is divisible by 5^b, where b is the largest integer s.t. 5^b<i there may be less confusion
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|