Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Learning
us a sample to explain:
12345678 8 we find! 2 the number
111 First we calculate the number of multiples of 2: 8/2 = 4
. 1. 1 Next we calculate the number of a multiple of 4: 8/4 = 2
1 Last we solve a third the number of layers is 2: 8/8 = 1
We have 4 + 2 + 1 = 7, so there have been a total of seven 2.
which is:
(Until power x is larger than n)
Here we can see: The method we usually find that a one demand (that is, every number count again), and this way we each row seek each row, although the effect the same, but for up fast. worth learning.