you have a sequence where each number is a multiple of 2 or 5 (so: 2^i * 5^j). Given the beginning of the sequence as 1,2,4,5,8,10,16... and find a algorithm to calculate the next number in the sequence?
this is generally a combination of three series series 1 :powers of 2(1,2,4,8....) series 2: powers of 5(1,5,25,125....) series 3 All product derived from series 1 and 2 such that they are arranged in increasing order and you can you can exclude the your product with 1 to avoid redundancy i.e. (10,20,40,50,....) And now finally you can derived the series in such a way by selecting the minimum number.
Given an integer n, write a function that returns count of trailing zeroes in n!. Examples: Input: n = 5 Output: 1 Factorial of 5 is 20 which has one trailing 0. Input: n = 20 Output: 4 Factorial of 20 is 2432902008176640000 which has 4 trailing zeroes. Input: n = 100 Output: 24
this is generally a combination of three series
ReplyDeleteseries 1 :powers of 2(1,2,4,8....)
series 2: powers of 5(1,5,25,125....)
series 3 All product derived from series 1 and 2 such that they are arranged in increasing order and you can you can exclude the your product with 1 to avoid redundancy i.e. (10,20,40,50,....)
And now finally you can derived the series in such a way by selecting the minimum number.
@Muffadal yeah right...and the working code for this i will post very soon..:)
ReplyDelete